From 1398675b084fadda64578392486db99521767799 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 21 Jul 2022 05:38:00 +0000 Subject: [PATCH] CodeGen from PR 19852 in Azure/azure-rest-api-specs Merge 6816a3c169da1af87adff765b4888d64669fc39a into 9ae616c4a5447e9cae43752b68f089bff2e46398 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 102 + .../SAMPLE.md | 834 ++++++++ .../pom.xml | 55 + .../storagemover/StorageMoverManager.java | 378 ++++ .../storagemover/fluent/AgentsClient.java | 200 ++ .../storagemover/fluent/EndpointsClient.java | 212 ++ .../fluent/JobDefinitionsClient.java | 321 +++ .../storagemover/fluent/JobRunsClient.java | 96 + .../storagemover/fluent/OperationsClient.java | 38 + .../storagemover/fluent/ProjectsClient.java | 203 ++ .../fluent/StorageMoverClient.java | 95 + .../fluent/StorageMoversClient.java | 210 ++ .../fluent/models/AgentInner.java | 200 ++ .../fluent/models/AgentProperties.java | 239 +++ .../fluent/models/AgentUpdateProperties.java | 46 + .../fluent/models/EndpointInner.java | 67 + .../fluent/models/JobDefinitionInner.java | 284 +++ .../models/JobDefinitionProperties.java | 329 +++ .../models/JobDefinitionUpdateProperties.java | 99 + .../fluent/models/JobRunInner.java | 335 ++++ .../fluent/models/JobRunProperties.java | 493 +++++ .../fluent/models/JobRunResourceIdInner.java | 35 + .../fluent/models/OperationInner.java | 121 ++ .../fluent/models/ProjectInner.java | 88 + .../fluent/models/ProjectProperties.java | 62 + .../models/ProjectUpdateProperties.java | 46 + .../fluent/models/StorageMoverInner.java | 103 + .../fluent/models/StorageMoverProperties.java | 62 + .../models/StorageMoverUpdateProperties.java | 46 + .../fluent/models/package-info.java | 6 + .../storagemover/fluent/package-info.java | 6 + .../implementation/AgentImpl.java | 211 ++ .../implementation/AgentsClientImpl.java | 1180 +++++++++++ .../implementation/AgentsImpl.java | 187 ++ .../implementation/EndpointImpl.java | 157 ++ .../implementation/EndpointsClientImpl.java | 1210 ++++++++++++ .../implementation/EndpointsImpl.java | 187 ++ .../implementation/JobDefinitionImpl.java | 297 +++ .../JobDefinitionsClientImpl.java | 1757 +++++++++++++++++ .../implementation/JobDefinitionsImpl.java | 304 +++ .../implementation/JobRunImpl.java | 169 ++ .../implementation/JobRunResourceIdImpl.java | 32 + .../implementation/JobRunsClientImpl.java | 613 ++++++ .../implementation/JobRunsImpl.java | 93 + .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 274 +++ .../implementation/OperationsImpl.java | 45 + .../implementation/ProjectImpl.java | 163 ++ .../implementation/ProjectsClientImpl.java | 1182 +++++++++++ .../implementation/ProjectsImpl.java | 187 ++ .../StorageMoverClientBuilder.java | 142 ++ .../StorageMoverClientImpl.java | 374 ++++ .../implementation/StorageMoverImpl.java | 202 ++ .../StorageMoversClientImpl.java | 1338 +++++++++++++ .../implementation/StorageMoversImpl.java | 169 ++ .../storagemover/implementation/Utils.java | 204 ++ .../implementation/package-info.java | 6 + .../storagemover/models/ActionType.java | 35 + .../storagemover/models/Agent.java | 259 +++ .../storagemover/models/AgentList.java | 57 + .../models/AgentPropertiesErrorDetails.java | 72 + .../storagemover/models/AgentStatus.java | 50 + .../models/AgentUpdateParameters.java | 62 + .../storagemover/models/Agents.java | 142 ++ ...torageBlobContainerEndpointProperties.java | 105 + ...BlobContainerEndpointUpdateProperties.java | 28 + .../storagemover/models/CopyMode.java | 38 + .../storagemover/models/Endpoint.java | 165 ++ .../models/EndpointBaseProperties.java | 74 + .../models/EndpointBaseUpdateParameters.java | 50 + .../models/EndpointBaseUpdateProperties.java | 46 + .../storagemover/models/EndpointList.java | 57 + .../storagemover/models/EndpointType.java | 38 + .../storagemover/models/Endpoints.java | 142 ++ .../storagemover/models/JobDefinition.java | 386 ++++ .../models/JobDefinitionList.java | 57 + .../models/JobDefinitionUpdateParameters.java | 108 + .../storagemover/models/JobDefinitions.java | 228 +++ .../storagemover/models/JobRun.java | 264 +++ .../storagemover/models/JobRunError.java | 98 + .../storagemover/models/JobRunList.java | 57 + .../storagemover/models/JobRunResourceId.java | 24 + .../storagemover/models/JobRunScanStatus.java | 41 + .../storagemover/models/JobRunStatus.java | 56 + .../storagemover/models/JobRuns.java | 89 + .../models/NfsMountEndpointProperties.java | 125 ++ .../NfsMountEndpointUpdateProperties.java | 28 + .../storagemover/models/NfsVersion.java | 41 + .../storagemover/models/Operation.java | 56 + .../storagemover/models/OperationDisplay.java | 89 + .../models/OperationListResult.java | 58 + .../storagemover/models/Operations.java | 33 + .../storagemover/models/Origin.java | 41 + .../storagemover/models/Project.java | 171 ++ .../storagemover/models/ProjectList.java | 57 + .../models/ProjectUpdateParameters.java | 62 + .../storagemover/models/Projects.java | 142 ++ .../models/ProvisioningState.java | 35 + .../storagemover/models/StorageMover.java | 241 +++ .../storagemover/models/StorageMoverList.java | 57 + .../models/StorageMoverUpdateParameters.java | 91 + .../storagemover/models/StorageMovers.java | 156 ++ .../storagemover/models/package-info.java | 6 + .../storagemover/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../AgentsCreateOrUpdateSamples.java | 28 + .../generated/AgentsDeleteSamples.java | 22 + .../generated/AgentsGetSamples.java | 24 + .../generated/AgentsListSamples.java | 22 + .../generated/AgentsUpdateSamples.java | 28 + .../EndpointsCreateOrUpdateSamples.java | 24 + .../generated/EndpointsDeleteSamples.java | 22 + .../generated/EndpointsGetSamples.java | 24 + .../generated/EndpointsListSamples.java | 22 + .../generated/EndpointsUpdateSamples.java | 28 + .../JobDefinitionsCreateOrUpdateSamples.java | 31 + .../JobDefinitionsDeleteSamples.java | 29 + .../generated/JobDefinitionsGetSamples.java | 29 + .../generated/JobDefinitionsListSamples.java | 22 + .../JobDefinitionsStartJobSamples.java | 29 + .../JobDefinitionsStopJobSamples.java | 29 + .../JobDefinitionsUpdateSamples.java | 37 + .../generated/JobRunsGetSamples.java | 30 + .../generated/JobRunsListSamples.java | 29 + .../generated/OperationsListSamples.java | 22 + .../ProjectsCreateOrUpdateSamples.java | 25 + .../generated/ProjectsDeleteSamples.java | 22 + .../generated/ProjectsGetSamples.java | 24 + .../generated/ProjectsListSamples.java | 22 + .../generated/ProjectsUpdateSamples.java | 28 + .../StorageMoversCreateOrUpdateSamples.java | 41 + .../generated/StorageMoversDeleteSamples.java | 22 + ...torageMoversGetByResourceGroupSamples.java | 24 + ...orageMoversListByResourceGroupSamples.java | 22 + .../generated/StorageMoversListSamples.java | 22 + .../generated/StorageMoversUpdateSamples.java | 28 + sdk/storagemover/ci.yml | 47 + sdk/storagemover/pom.xml | 15 + 141 files changed, 21367 insertions(+) create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/README.md create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/SAMPLE.md create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/pom.xml create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/AgentsClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/EndpointsClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobDefinitionsClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobRunsClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/OperationsClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/ProjectsClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoversClient.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunResourceIdImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversImpl.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/Utils.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agent.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agents.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoint.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoints.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinition.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitions.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRun.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunResourceId.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRuns.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operation.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operations.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Project.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Projects.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMover.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMovers.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/package-info.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/package-info.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/module-info.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsCreateOrUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsDeleteSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsGetSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsCreateOrUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsDeleteSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsGetSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsCreateOrUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsDeleteSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsGetSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStartJobSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStopJobSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsGetSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/OperationsListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsCreateOrUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsDeleteSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsGetSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversCreateOrUpdateSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversDeleteSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversGetByResourceGroupSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListByResourceGroupSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListSamples.java create mode 100644 sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversUpdateSamples.java create mode 100644 sdk/storagemover/ci.yml create mode 100644 sdk/storagemover/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 13980342d5e98..577791b5465ad 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -355,6 +355,7 @@ com.azure.resourcemanager:azure-resourcemanager-education;1.0.0-beta.2;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-orbital;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-networkfunction;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-resourceconnector;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b449eb2492b47..39be8cd127b56 100644 --- a/pom.xml +++ b/pom.xml @@ -991,6 +991,7 @@ sdk/storage sdk/storagecache sdk/storageimportexport + sdk/storagemover sdk/storagepool sdk/streamanalytics sdk/subscription diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md b/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md new file mode 100644 index 0000000000000..acdf343aa936f --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-07-21) + +- Azure Resource Manager StorageMover client library for Java. This package contains Microsoft Azure SDK for StorageMover Management SDK. The Azure Storage Mover REST API. Package tag package-2022-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/README.md b/sdk/storagemover/azure-resourcemanager-storagemover/README.md new file mode 100644 index 0000000000000..95ee8ca5e00b4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager StorageMover client library for Java + +Azure Resource Manager StorageMover client library for Java. + +This package contains Microsoft Azure SDK for StorageMover Management SDK. The Azure Storage Mover REST API. Package tag package-2022-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-storagemover;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-storagemover + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +StorageMoverManager manager = StorageMoverManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storagemover/azure-resourcemanager-storagemover/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/SAMPLE.md b/sdk/storagemover/azure-resourcemanager-storagemover/SAMPLE.md new file mode 100644 index 0000000000000..7a684e7bf622f --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/SAMPLE.md @@ -0,0 +1,834 @@ +# Code snippets and samples + + +## Agents + +- [CreateOrUpdate](#agents_createorupdate) +- [Delete](#agents_delete) +- [Get](#agents_get) +- [List](#agents_list) +- [Update](#agents_update) + +## Endpoints + +- [CreateOrUpdate](#endpoints_createorupdate) +- [Delete](#endpoints_delete) +- [Get](#endpoints_get) +- [List](#endpoints_list) +- [Update](#endpoints_update) + +## JobDefinitions + +- [CreateOrUpdate](#jobdefinitions_createorupdate) +- [Delete](#jobdefinitions_delete) +- [Get](#jobdefinitions_get) +- [List](#jobdefinitions_list) +- [StartJob](#jobdefinitions_startjob) +- [StopJob](#jobdefinitions_stopjob) +- [Update](#jobdefinitions_update) + +## JobRuns + +- [Get](#jobruns_get) +- [List](#jobruns_list) + +## Operations + +- [List](#operations_list) + +## Projects + +- [CreateOrUpdate](#projects_createorupdate) +- [Delete](#projects_delete) +- [Get](#projects_get) +- [List](#projects_list) +- [Update](#projects_update) + +## StorageMovers + +- [CreateOrUpdate](#storagemovers_createorupdate) +- [Delete](#storagemovers_delete) +- [GetByResourceGroup](#storagemovers_getbyresourcegroup) +- [List](#storagemovers_list) +- [ListByResourceGroup](#storagemovers_listbyresourcegroup) +- [Update](#storagemovers_update) +### Agents_CreateOrUpdate + +```java +/** Samples for Agents CreateOrUpdate. */ +public final class AgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json + */ + /** + * Sample code: Agents_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .agents() + .define("examples-agentName") + .withExistingStorageMover("examples-rg", "examples-storageMoverName") + .withDescription("Example Agent Description") + .withArcResourceId( + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.HybridCompute/machines/examples-hybridComputeName") + .withArcVmUuid("3bb2c024-eba9-4d18-9e7a-1d772fcc5fe9") + .create(); + } +} +``` + +### Agents_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Agents Delete. */ +public final class AgentsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json + */ + /** + * Sample code: Agents_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.agents().delete("examples-rg", "examples-storageMoverName", "examples-agentName", Context.NONE); + } +} +``` + +### Agents_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Agents Get. */ +public final class AgentsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json + */ + /** + * Sample code: Agents_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .agents() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-agentName", Context.NONE); + } +} +``` + +### Agents_List + +```java +import com.azure.core.util.Context; + +/** Samples for Agents List. */ +public final class AgentsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json + */ + /** + * Sample code: Agents_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.agents().list("examples-rg", "examples-storageMoverName", Context.NONE); + } +} +``` + +### Agents_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.Agent; + +/** Samples for Agents Update. */ +public final class AgentsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json + */ + /** + * Sample code: Agents_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + Agent resource = + manager + .agents() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-agentName", Context.NONE) + .getValue(); + resource.update().withDescription("Updated Agent Description").apply(); + } +} +``` + +### Endpoints_CreateOrUpdate + +```java +/** Samples for Endpoints CreateOrUpdate. */ +public final class EndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json + */ + /** + * Sample code: Endpoints_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .endpoints() + .define("examples-endpointName") + .withExistingStorageMover("examples-rg", "examples-storageMoverName") + .create(); + } +} +``` + +### Endpoints_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints Delete. */ +public final class EndpointsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json + */ + /** + * Sample code: Endpoints_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.endpoints().delete("examples-rg", "examples-storageMoverName", "examples-endpointName", Context.NONE); + } +} +``` + +### Endpoints_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints Get. */ +public final class EndpointsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json + */ + /** + * Sample code: Endpoints_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .endpoints() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-endpointName", Context.NONE); + } +} +``` + +### Endpoints_List + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints List. */ +public final class EndpointsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json + */ + /** + * Sample code: Endpoints_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.endpoints().list("examples-rg", "examples-storageMoverName", Context.NONE); + } +} +``` + +### Endpoints_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.Endpoint; + +/** Samples for Endpoints Update. */ +public final class EndpointsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json + */ + /** + * Sample code: Endpoints_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + Endpoint resource = + manager + .endpoints() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-endpointName", Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### JobDefinitions_CreateOrUpdate + +```java +/** Samples for JobDefinitions CreateOrUpdate. */ +public final class JobDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json + */ + /** + * Sample code: JobDefinitions_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsCreateOrUpdate( + com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .define("examples-jobDefinitionName") + .withExistingProject("examples-rg", "examples-storageMoverName", "examples-projectName") + .withDescription("Example Job Definition Description") + .withSourceName("examples-sourceEndpointName") + .withSourceSubpath("/") + .withTargetName("examples-targetEndpointName") + .withTargetSubpath("/") + .withAgentName("migration-agent") + .create(); + } +} +``` + +### JobDefinitions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobDefinitions Delete. */ +public final class JobDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json + */ + /** + * Sample code: Projects_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .delete( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} +``` + +### JobDefinitions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobDefinitions Get. */ +public final class JobDefinitionsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json + */ + /** + * Sample code: JobDefinitions_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .getWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} +``` + +### JobDefinitions_List + +```java +import com.azure.core.util.Context; + +/** Samples for JobDefinitions List. */ +public final class JobDefinitionsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json + */ + /** + * Sample code: JobDefinitions_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.jobDefinitions().list("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE); + } +} +``` + +### JobDefinitions_StartJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobDefinitions StartJob. */ +public final class JobDefinitionsStartJobSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json + */ + /** + * Sample code: JobDefinitions_StartJob. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsStartJob(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .startJobWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} +``` + +### JobDefinitions_StopJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobDefinitions StopJob. */ +public final class JobDefinitionsStopJobSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json + */ + /** + * Sample code: JobDefinitions_StopJob. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsStopJob(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .stopJobWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} +``` + +### JobDefinitions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.JobDefinition; + +/** Samples for JobDefinitions Update. */ +public final class JobDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json + */ + /** + * Sample code: JobDefinitions_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + JobDefinition resource = + manager + .jobDefinitions() + .getWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE) + .getValue(); + resource + .update() + .withDescription("Updated Job Definition Description") + .withAgentName("updatedAgentName") + .apply(); + } +} +``` + +### JobRuns_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobRuns Get. */ +public final class JobRunsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json + */ + /** + * Sample code: JobRuns_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobRunsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobRuns() + .getWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + "examples-jobRunName", + Context.NONE); + } +} +``` + +### JobRuns_List + +```java +import com.azure.core.util.Context; + +/** Samples for JobRuns List. */ +public final class JobRunsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json + */ + /** + * Sample code: JobRuns_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobRunsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobRuns() + .list( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void operationsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### Projects_CreateOrUpdate + +```java +/** Samples for Projects CreateOrUpdate. */ +public final class ProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json + */ + /** + * Sample code: Projects_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .projects() + .define("examples-projectName") + .withExistingStorageMover("examples-rg", "examples-storageMoverName") + .withDescription("Example Project Description") + .create(); + } +} +``` + +### Projects_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Projects Delete. */ +public final class ProjectsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json + */ + /** + * Sample code: Projects_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.projects().delete("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE); + } +} +``` + +### Projects_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Projects Get. */ +public final class ProjectsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json + */ + /** + * Sample code: Projects_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .projects() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE); + } +} +``` + +### Projects_List + +```java +import com.azure.core.util.Context; + +/** Samples for Projects List. */ +public final class ProjectsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json + */ + /** + * Sample code: Projects_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.projects().list("examples-rg", "examples-storageMoverName", Context.NONE); + } +} +``` + +### Projects_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.Project; + +/** Samples for Projects Update. */ +public final class ProjectsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json + */ + /** + * Sample code: Projects_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + Project resource = + manager + .projects() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE) + .getValue(); + resource.update().withDescription("Example Project Description").apply(); + } +} +``` + +### StorageMovers_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for StorageMovers CreateOrUpdate. */ +public final class StorageMoversCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json + */ + /** + * Sample code: StorageMovers_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .storageMovers() + .define("examples-storageMoverName") + .withRegion("eastus2") + .withExistingResourceGroup("examples-rg") + .withTags(mapOf("key1", "value1", "key2", "value2")) + .withDescription("Example Storage Mover Description") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### StorageMovers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for StorageMovers Delete. */ +public final class StorageMoversDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json + */ + /** + * Sample code: StorageMovers_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.storageMovers().delete("examples-rg", "examples-storageMoverName", Context.NONE); + } +} +``` + +### StorageMovers_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for StorageMovers GetByResourceGroup. */ +public final class StorageMoversGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json + */ + /** + * Sample code: StorageMovers_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .storageMovers() + .getByResourceGroupWithResponse("examples-rg", "examples-storageMoverName", Context.NONE); + } +} +``` + +### StorageMovers_List + +```java +import com.azure.core.util.Context; + +/** Samples for StorageMovers List. */ +public final class StorageMoversListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json + */ + /** + * Sample code: StorageMovers_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.storageMovers().list(Context.NONE); + } +} +``` + +### StorageMovers_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for StorageMovers ListByResourceGroup. */ +public final class StorageMoversListByResourceGroupSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json + */ + /** + * Sample code: StorageMovers_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.storageMovers().listByResourceGroup("examples-rg", Context.NONE); + } +} +``` + +### StorageMovers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.StorageMover; + +/** Samples for StorageMovers Update. */ +public final class StorageMoversUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.json + */ + /** + * Sample code: StorageMovers_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + StorageMover resource = + manager + .storageMovers() + .getByResourceGroupWithResponse("examples-rg", "examples-storageMoverName", Context.NONE) + .getValue(); + resource.update().withDescription("Updated Storage Mover Description").apply(); + } +} +``` + diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml new file mode 100644 index 0000000000000..8128cd434f613 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-storagemover + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for StorageMover Management + This package contains Microsoft Azure SDK for StorageMover Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Storage Mover REST API. Package tag package-2022-07-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.30.0 + + + com.azure + azure-core-management + 1.7.0 + + + diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java new file mode 100644 index 0000000000000..6fd0978c9992b --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.StorageMoverClient; +import com.azure.resourcemanager.storagemover.implementation.AgentsImpl; +import com.azure.resourcemanager.storagemover.implementation.EndpointsImpl; +import com.azure.resourcemanager.storagemover.implementation.JobDefinitionsImpl; +import com.azure.resourcemanager.storagemover.implementation.JobRunsImpl; +import com.azure.resourcemanager.storagemover.implementation.OperationsImpl; +import com.azure.resourcemanager.storagemover.implementation.ProjectsImpl; +import com.azure.resourcemanager.storagemover.implementation.StorageMoverClientBuilder; +import com.azure.resourcemanager.storagemover.implementation.StorageMoversImpl; +import com.azure.resourcemanager.storagemover.models.Agents; +import com.azure.resourcemanager.storagemover.models.Endpoints; +import com.azure.resourcemanager.storagemover.models.JobDefinitions; +import com.azure.resourcemanager.storagemover.models.JobRuns; +import com.azure.resourcemanager.storagemover.models.Operations; +import com.azure.resourcemanager.storagemover.models.Projects; +import com.azure.resourcemanager.storagemover.models.StorageMovers; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to StorageMoverManager. The Azure Storage Mover REST API. */ +public final class StorageMoverManager { + private Operations operations; + + private StorageMovers storageMovers; + + private Agents agents; + + private Endpoints endpoints; + + private Projects projects; + + private JobDefinitions jobDefinitions; + + private JobRuns jobRuns; + + private final StorageMoverClient clientObject; + + private StorageMoverManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new StorageMoverClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of StorageMover service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the StorageMover service API instance. + */ + public static StorageMoverManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of StorageMover service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the StorageMover service API instance. + */ + public static StorageMoverManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new StorageMoverManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create StorageMoverManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new StorageMoverManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of StorageMover service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the StorageMover service API instance. + */ + public StorageMoverManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.storagemover") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new StorageMoverManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of StorageMovers. It manages StorageMover. + * + * @return Resource collection API of StorageMovers. + */ + public StorageMovers storageMovers() { + if (this.storageMovers == null) { + this.storageMovers = new StorageMoversImpl(clientObject.getStorageMovers(), this); + } + return storageMovers; + } + + /** + * Gets the resource collection API of Agents. It manages Agent. + * + * @return Resource collection API of Agents. + */ + public Agents agents() { + if (this.agents == null) { + this.agents = new AgentsImpl(clientObject.getAgents(), this); + } + return agents; + } + + /** + * Gets the resource collection API of Endpoints. It manages Endpoint. + * + * @return Resource collection API of Endpoints. + */ + public Endpoints endpoints() { + if (this.endpoints == null) { + this.endpoints = new EndpointsImpl(clientObject.getEndpoints(), this); + } + return endpoints; + } + + /** + * Gets the resource collection API of Projects. It manages Project. + * + * @return Resource collection API of Projects. + */ + public Projects projects() { + if (this.projects == null) { + this.projects = new ProjectsImpl(clientObject.getProjects(), this); + } + return projects; + } + + /** + * Gets the resource collection API of JobDefinitions. It manages JobDefinition. + * + * @return Resource collection API of JobDefinitions. + */ + public JobDefinitions jobDefinitions() { + if (this.jobDefinitions == null) { + this.jobDefinitions = new JobDefinitionsImpl(clientObject.getJobDefinitions(), this); + } + return jobDefinitions; + } + + /** + * Gets the resource collection API of JobRuns. + * + * @return Resource collection API of JobRuns. + */ + public JobRuns jobRuns() { + if (this.jobRuns == null) { + this.jobRuns = new JobRunsImpl(clientObject.getJobRuns(), this); + } + return jobRuns; + } + + /** + * @return Wrapped service client StorageMoverClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public StorageMoverClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/AgentsClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/AgentsClient.java new file mode 100644 index 0000000000000..c86aa6bbdd9d2 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/AgentsClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; +import com.azure.resourcemanager.storagemover.models.AgentUpdateParameters; + +/** An instance of this class provides access to all the operations defined in AgentsClient. */ +public interface AgentsClient { + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName); + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentInner get(String resourceGroupName, String storageMoverName, String agentName); + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String storageMoverName, String agentName, Context context); + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentInner createOrUpdate(String resourceGroupName, String storageMoverName, String agentName, AgentInner agent); + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String storageMoverName, String agentName, AgentInner agent, Context context); + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentInner update(String resourceGroupName, String storageMoverName, String agentName, AgentUpdateParameters agent); + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String agentName, + AgentUpdateParameters agent, + Context context); + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageMoverName, String agentName); + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String agentName, Context context); + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String agentName); + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String agentName, Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/EndpointsClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/EndpointsClient.java new file mode 100644 index 0000000000000..af69a64d7cc05 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/EndpointsClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; +import com.azure.resourcemanager.storagemover.models.EndpointBaseUpdateParameters; + +/** An instance of this class provides access to all the operations defined in EndpointsClient. */ +public interface EndpointsClient { + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName); + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointInner get(String resourceGroupName, String storageMoverName, String endpointName); + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String storageMoverName, String endpointName, Context context); + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointInner createOrUpdate( + String resourceGroupName, String storageMoverName, String endpointName, EndpointInner endpointParam); + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointInner endpointParam, + Context context); + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointInner update( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam); + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam, + Context context); + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String endpointName); + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String endpointName, Context context); + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String endpointName); + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String endpointName, Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobDefinitionsClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobDefinitionsClient.java new file mode 100644 index 0000000000000..8dd7de0dc3472 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobDefinitionsClient.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunResourceIdInner; +import com.azure.resourcemanager.storagemover.models.JobDefinitionUpdateParameters; + +/** An instance of this class provides access to all the operations defined in JobDefinitionsClient. */ +public interface JobDefinitionsClient { + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName, String projectName); + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, Context context); + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobDefinitionInner get( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobDefinitionInner createOrUpdate( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition); + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition, + Context context); + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobDefinitionInner update( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition); + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition, + Context context); + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobRunResourceIdInner startJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobRunResourceIdInner stopJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response stopJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobRunsClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobRunsClient.java new file mode 100644 index 0000000000000..f2cb08488e56a --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/JobRunsClient.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; + +/** An instance of this class provides access to all the operations defined in JobRunsClient. */ +public interface JobRunsClient { + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobRunInner get( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName); + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName, + Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/OperationsClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/OperationsClient.java new file mode 100644 index 0000000000000..0e909ea35a0f4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/ProjectsClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/ProjectsClient.java new file mode 100644 index 0000000000000..9a736d6c2eb4f --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/ProjectsClient.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; +import com.azure.resourcemanager.storagemover.models.ProjectUpdateParameters; + +/** An instance of this class provides access to all the operations defined in ProjectsClient. */ +public interface ProjectsClient { + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName); + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner get(String resourceGroupName, String storageMoverName, String projectName); + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String storageMoverName, String projectName, Context context); + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner createOrUpdate( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project); + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project, Context context); + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner update( + String resourceGroupName, String storageMoverName, String projectName, ProjectUpdateParameters project); + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + ProjectUpdateParameters project, + Context context); + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String projectName); + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String projectName, Context context); + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String projectName); + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, String projectName, Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java new file mode 100644 index 0000000000000..369dec65da86d --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for StorageMoverClient class. */ +public interface StorageMoverClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the StorageMoversClient object to access its operations. + * + * @return the StorageMoversClient object. + */ + StorageMoversClient getStorageMovers(); + + /** + * Gets the AgentsClient object to access its operations. + * + * @return the AgentsClient object. + */ + AgentsClient getAgents(); + + /** + * Gets the EndpointsClient object to access its operations. + * + * @return the EndpointsClient object. + */ + EndpointsClient getEndpoints(); + + /** + * Gets the ProjectsClient object to access its operations. + * + * @return the ProjectsClient object. + */ + ProjectsClient getProjects(); + + /** + * Gets the JobDefinitionsClient object to access its operations. + * + * @return the JobDefinitionsClient object. + */ + JobDefinitionsClient getJobDefinitions(); + + /** + * Gets the JobRunsClient object to access its operations. + * + * @return the JobRunsClient object. + */ + JobRunsClient getJobRuns(); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoversClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoversClient.java new file mode 100644 index 0000000000000..93873ecaef10b --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoversClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; +import com.azure.resourcemanager.storagemover.models.StorageMoverUpdateParameters; + +/** An instance of this class provides access to all the operations defined in StorageMoversClient. */ +public interface StorageMoversClient { + /** + * Lists all Storage Movers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all Storage Movers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageMoverInner getByResourceGroup(String resourceGroupName, String storageMoverName); + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String storageMoverName, Context context); + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageMoverInner createOrUpdate(String resourceGroupName, String storageMoverName, StorageMoverInner storageMover); + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String storageMoverName, StorageMoverInner storageMover, Context context); + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageMoverInner update( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover); + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover, Context context); + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageMoverName); + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageMoverName, Context context); + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName); + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageMoverName, Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java new file mode 100644 index 0000000000000..7603a9f918952 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.models.AgentPropertiesErrorDetails; +import com.azure.resourcemanager.storagemover.models.AgentStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The agent resource. */ +@Fluent +public final class AgentInner extends ProxyResource { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private AgentProperties innerProperties; + + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private AgentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the description property: A description for the agent. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the agent. + * + * @param description the description value to set. + * @return the AgentInner object itself. + */ + public AgentInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the agentVersion property: The agent version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.innerProperties() == null ? null : this.innerProperties().agentVersion(); + } + + /** + * Get the arcResourceId property: The fully qualified resource ID of the hybrid compute resource for the agent. + * + * @return the arcResourceId value. + */ + public String arcResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().arcResourceId(); + } + + /** + * Set the arcResourceId property: The fully qualified resource ID of the hybrid compute resource for the agent. + * + * @param arcResourceId the arcResourceId value to set. + * @return the AgentInner object itself. + */ + public AgentInner withArcResourceId(String arcResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentProperties(); + } + this.innerProperties().withArcResourceId(arcResourceId); + return this; + } + + /** + * Get the arcVmUuid property: A GUID for this agent. + * + * @return the arcVmUuid value. + */ + public String arcVmUuid() { + return this.innerProperties() == null ? null : this.innerProperties().arcVmUuid(); + } + + /** + * Set the arcVmUuid property: A GUID for this agent. + * + * @param arcVmUuid the arcVmUuid value to set. + * @return the AgentInner object itself. + */ + public AgentInner withArcVmUuid(String arcVmUuid) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentProperties(); + } + this.innerProperties().withArcVmUuid(arcVmUuid); + return this; + } + + /** + * Get the agentStatus property: The agent status. + * + * @return the agentStatus value. + */ + public AgentStatus agentStatus() { + return this.innerProperties() == null ? null : this.innerProperties().agentStatus(); + } + + /** + * Get the lastStatusUpdate property: The last updated time of the agent status. + * + * @return the lastStatusUpdate value. + */ + public OffsetDateTime lastStatusUpdate() { + return this.innerProperties() == null ? null : this.innerProperties().lastStatusUpdate(); + } + + /** + * Get the localIpAddress property: Local IP address reported by the agent. + * + * @return the localIpAddress value. + */ + public String localIpAddress() { + return this.innerProperties() == null ? null : this.innerProperties().localIpAddress(); + } + + /** + * Get the memoryInMB property: Available memory reported by the agent, in MB. + * + * @return the memoryInMB value. + */ + public Long memoryInMB() { + return this.innerProperties() == null ? null : this.innerProperties().memoryInMB(); + } + + /** + * Get the numberOfCores property: Available compute cores reported by the agent. + * + * @return the numberOfCores value. + */ + public Long numberOfCores() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfCores(); + } + + /** + * Get the errorDetails property: The errorDetails property. + * + * @return the errorDetails value. + */ + public AgentPropertiesErrorDetails errorDetails() { + return this.innerProperties() == null ? null : this.innerProperties().errorDetails(); + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java new file mode 100644 index 0000000000000..368d5304c21e1 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.models.AgentPropertiesErrorDetails; +import com.azure.resourcemanager.storagemover.models.AgentStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The AgentProperties model. */ +@Fluent +public final class AgentProperties { + /* + * A description for the agent. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The agent version. + */ + @JsonProperty(value = "agentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String agentVersion; + + /* + * The fully qualified resource ID of the hybrid compute resource for the + * agent. + */ + @JsonProperty(value = "arcResourceId", required = true) + private String arcResourceId; + + /* + * A GUID for this agent. + */ + @JsonProperty(value = "arcVmUuid", required = true) + private String arcVmUuid; + + /* + * The agent status. + */ + @JsonProperty(value = "agentStatus", access = JsonProperty.Access.WRITE_ONLY) + private AgentStatus agentStatus; + + /* + * The last updated time of the agent status. + */ + @JsonProperty(value = "lastStatusUpdate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastStatusUpdate; + + /* + * Local IP address reported by the agent. + */ + @JsonProperty(value = "localIPAddress", access = JsonProperty.Access.WRITE_ONLY) + private String localIpAddress; + + /* + * Available memory reported by the agent, in MB. + */ + @JsonProperty(value = "memoryInMB", access = JsonProperty.Access.WRITE_ONLY) + private Long memoryInMB; + + /* + * Available compute cores reported by the agent. + */ + @JsonProperty(value = "numberOfCores", access = JsonProperty.Access.WRITE_ONLY) + private Long numberOfCores; + + /* + * The errorDetails property. + */ + @JsonProperty(value = "errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private AgentPropertiesErrorDetails errorDetails; + + /* + * The provisioning state of this resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the description property: A description for the agent. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the agent. + * + * @param description the description value to set. + * @return the AgentProperties object itself. + */ + public AgentProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the agentVersion property: The agent version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get the arcResourceId property: The fully qualified resource ID of the hybrid compute resource for the agent. + * + * @return the arcResourceId value. + */ + public String arcResourceId() { + return this.arcResourceId; + } + + /** + * Set the arcResourceId property: The fully qualified resource ID of the hybrid compute resource for the agent. + * + * @param arcResourceId the arcResourceId value to set. + * @return the AgentProperties object itself. + */ + public AgentProperties withArcResourceId(String arcResourceId) { + this.arcResourceId = arcResourceId; + return this; + } + + /** + * Get the arcVmUuid property: A GUID for this agent. + * + * @return the arcVmUuid value. + */ + public String arcVmUuid() { + return this.arcVmUuid; + } + + /** + * Set the arcVmUuid property: A GUID for this agent. + * + * @param arcVmUuid the arcVmUuid value to set. + * @return the AgentProperties object itself. + */ + public AgentProperties withArcVmUuid(String arcVmUuid) { + this.arcVmUuid = arcVmUuid; + return this; + } + + /** + * Get the agentStatus property: The agent status. + * + * @return the agentStatus value. + */ + public AgentStatus agentStatus() { + return this.agentStatus; + } + + /** + * Get the lastStatusUpdate property: The last updated time of the agent status. + * + * @return the lastStatusUpdate value. + */ + public OffsetDateTime lastStatusUpdate() { + return this.lastStatusUpdate; + } + + /** + * Get the localIpAddress property: Local IP address reported by the agent. + * + * @return the localIpAddress value. + */ + public String localIpAddress() { + return this.localIpAddress; + } + + /** + * Get the memoryInMB property: Available memory reported by the agent, in MB. + * + * @return the memoryInMB value. + */ + public Long memoryInMB() { + return this.memoryInMB; + } + + /** + * Get the numberOfCores property: Available compute cores reported by the agent. + * + * @return the numberOfCores value. + */ + public Long numberOfCores() { + return this.numberOfCores; + } + + /** + * Get the errorDetails property: The errorDetails property. + * + * @return the errorDetails value. + */ + public AgentPropertiesErrorDetails errorDetails() { + return this.errorDetails; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (arcResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property arcResourceId in model AgentProperties")); + } + if (arcVmUuid() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property arcVmUuid in model AgentProperties")); + } + if (errorDetails() != null) { + errorDetails().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AgentProperties.class); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java new file mode 100644 index 0000000000000..db53acd5901b5 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AgentUpdateProperties model. */ +@Fluent +public final class AgentUpdateProperties { + /* + * A description for the agent. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the description property: A description for the agent. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the agent. + * + * @param description the description value to set. + * @return the AgentUpdateProperties object itself. + */ + public AgentUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java new file mode 100644 index 0000000000000..619409325708f --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.models.EndpointBaseProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The endpoint resource, which contains information about file sources and targets. */ +@Fluent +public final class EndpointInner extends ProxyResource { + /* + * The resource specific properties for the Storage Mover resource. + */ + @JsonProperty(value = "properties") + private EndpointBaseProperties properties; + + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the properties property: The resource specific properties for the Storage Mover resource. + * + * @return the properties value. + */ + public EndpointBaseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource specific properties for the Storage Mover resource. + * + * @param properties the properties value to set. + * @return the EndpointInner object itself. + */ + public EndpointInner withProperties(EndpointBaseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java new file mode 100644 index 0000000000000..89d8cd2974bc3 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.models.CopyMode; +import com.azure.resourcemanager.storagemover.models.JobRunStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The job definition resource. */ +@Fluent +public final class JobDefinitionInner extends ProxyResource { + /* + * Job definition properties. + */ + @JsonProperty(value = "properties") + private JobDefinitionProperties innerProperties; + + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Job definition properties. + * + * @return the innerProperties value. + */ + private JobDefinitionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the description property: A description for the job definition. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the job definition. + * + * @param description the description value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the copyMode property: Strategy to use for copy. + * + * @return the copyMode value. + */ + public CopyMode copyMode() { + return this.innerProperties() == null ? null : this.innerProperties().copyMode(); + } + + /** + * Set the copyMode property: Strategy to use for copy. + * + * @param copyMode the copyMode value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withCopyMode(CopyMode copyMode) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withCopyMode(copyMode); + return this; + } + + /** + * Get the sourceName property: The name of the source endpoint. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceName(); + } + + /** + * Set the sourceName property: The name of the source endpoint. + * + * @param sourceName the sourceName value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withSourceName(String sourceName) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withSourceName(sourceName); + return this; + } + + /** + * Get the sourceResourceId property: Fully qualified resource ID of the source endpoint. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Get the sourceSubpath property: The subpath to use when reading from the source Endpoint. + * + * @return the sourceSubpath value. + */ + public String sourceSubpath() { + return this.innerProperties() == null ? null : this.innerProperties().sourceSubpath(); + } + + /** + * Set the sourceSubpath property: The subpath to use when reading from the source Endpoint. + * + * @param sourceSubpath the sourceSubpath value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withSourceSubpath(String sourceSubpath) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withSourceSubpath(sourceSubpath); + return this; + } + + /** + * Get the targetName property: The name of the target endpoint. + * + * @return the targetName value. + */ + public String targetName() { + return this.innerProperties() == null ? null : this.innerProperties().targetName(); + } + + /** + * Set the targetName property: The name of the target endpoint. + * + * @param targetName the targetName value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withTargetName(String targetName) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withTargetName(targetName); + return this; + } + + /** + * Get the targetResourceId property: Fully qualified resource ID of the target endpoint. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceId(); + } + + /** + * Get the targetSubpath property: The subpath to use when writing to the target Endpoint. + * + * @return the targetSubpath value. + */ + public String targetSubpath() { + return this.innerProperties() == null ? null : this.innerProperties().targetSubpath(); + } + + /** + * Set the targetSubpath property: The subpath to use when writing to the target Endpoint. + * + * @param targetSubpath the targetSubpath value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withTargetSubpath(String targetSubpath) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withTargetSubpath(targetSubpath); + return this; + } + + /** + * Get the latestJobRunName property: The name of the job run in a non-terminal state, if exists. + * + * @return the latestJobRunName value. + */ + public String latestJobRunName() { + return this.innerProperties() == null ? null : this.innerProperties().latestJobRunName(); + } + + /** + * Get the latestJobRunResourceId property: The fully qualified resource ID of the job run in a non-terminal state, + * if exists. + * + * @return the latestJobRunResourceId value. + */ + public String latestJobRunResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().latestJobRunResourceId(); + } + + /** + * Get the latestJobRunStatus property: The current status of the job run in a non-terminal state, if exists. + * + * @return the latestJobRunStatus value. + */ + public JobRunStatus latestJobRunStatus() { + return this.innerProperties() == null ? null : this.innerProperties().latestJobRunStatus(); + } + + /** + * Get the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @return the agentName value. + */ + public String agentName() { + return this.innerProperties() == null ? null : this.innerProperties().agentName(); + } + + /** + * Set the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @param agentName the agentName value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withAgentName(String agentName) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionProperties(); + } + this.innerProperties().withAgentName(agentName); + return this; + } + + /** + * Get the agentResourceId property: Fully qualified resource id of the agent to assign for new job runs of this + * definition. + * + * @return the agentResourceId value. + */ + public String agentResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().agentResourceId(); + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java new file mode 100644 index 0000000000000..faf7ff87ac45c --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.models.CopyMode; +import com.azure.resourcemanager.storagemover.models.JobRunStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Job definition properties. */ +@Fluent +public final class JobDefinitionProperties { + /* + * A description for the job definition. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Strategy to use for copy. + */ + @JsonProperty(value = "copyMode") + private CopyMode copyMode; + + /* + * The name of the source endpoint. + */ + @JsonProperty(value = "sourceName", required = true) + private String sourceName; + + /* + * Fully qualified resource ID of the source endpoint. + */ + @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceId; + + /* + * The subpath to use when reading from the source Endpoint. + */ + @JsonProperty(value = "sourceSubpath") + private String sourceSubpath; + + /* + * The name of the target endpoint. + */ + @JsonProperty(value = "targetName", required = true) + private String targetName; + + /* + * Fully qualified resource ID of the target endpoint. + */ + @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceId; + + /* + * The subpath to use when writing to the target Endpoint. + */ + @JsonProperty(value = "targetSubpath") + private String targetSubpath; + + /* + * The name of the job run in a non-terminal state, if exists. + */ + @JsonProperty(value = "latestJobRunName", access = JsonProperty.Access.WRITE_ONLY) + private String latestJobRunName; + + /* + * The fully qualified resource ID of the job run in a non-terminal state, + * if exists. + */ + @JsonProperty(value = "latestJobRunResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String latestJobRunResourceId; + + /* + * The current status of the job run in a non-terminal state, if exists. + */ + @JsonProperty(value = "latestJobRunStatus", access = JsonProperty.Access.WRITE_ONLY) + private JobRunStatus latestJobRunStatus; + + /* + * Name of the agent to assign for new job runs of this definition. + */ + @JsonProperty(value = "agentName") + private String agentName; + + /* + * Fully qualified resource id of the agent to assign for new job runs of + * this definition. + */ + @JsonProperty(value = "agentResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String agentResourceId; + + /* + * The provisioning state of this resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the description property: A description for the job definition. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the job definition. + * + * @param description the description value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the copyMode property: Strategy to use for copy. + * + * @return the copyMode value. + */ + public CopyMode copyMode() { + return this.copyMode; + } + + /** + * Set the copyMode property: Strategy to use for copy. + * + * @param copyMode the copyMode value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withCopyMode(CopyMode copyMode) { + this.copyMode = copyMode; + return this; + } + + /** + * Get the sourceName property: The name of the source endpoint. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.sourceName; + } + + /** + * Set the sourceName property: The name of the source endpoint. + * + * @param sourceName the sourceName value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withSourceName(String sourceName) { + this.sourceName = sourceName; + return this; + } + + /** + * Get the sourceResourceId property: Fully qualified resource ID of the source endpoint. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the sourceSubpath property: The subpath to use when reading from the source Endpoint. + * + * @return the sourceSubpath value. + */ + public String sourceSubpath() { + return this.sourceSubpath; + } + + /** + * Set the sourceSubpath property: The subpath to use when reading from the source Endpoint. + * + * @param sourceSubpath the sourceSubpath value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withSourceSubpath(String sourceSubpath) { + this.sourceSubpath = sourceSubpath; + return this; + } + + /** + * Get the targetName property: The name of the target endpoint. + * + * @return the targetName value. + */ + public String targetName() { + return this.targetName; + } + + /** + * Set the targetName property: The name of the target endpoint. + * + * @param targetName the targetName value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withTargetName(String targetName) { + this.targetName = targetName; + return this; + } + + /** + * Get the targetResourceId property: Fully qualified resource ID of the target endpoint. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Get the targetSubpath property: The subpath to use when writing to the target Endpoint. + * + * @return the targetSubpath value. + */ + public String targetSubpath() { + return this.targetSubpath; + } + + /** + * Set the targetSubpath property: The subpath to use when writing to the target Endpoint. + * + * @param targetSubpath the targetSubpath value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withTargetSubpath(String targetSubpath) { + this.targetSubpath = targetSubpath; + return this; + } + + /** + * Get the latestJobRunName property: The name of the job run in a non-terminal state, if exists. + * + * @return the latestJobRunName value. + */ + public String latestJobRunName() { + return this.latestJobRunName; + } + + /** + * Get the latestJobRunResourceId property: The fully qualified resource ID of the job run in a non-terminal state, + * if exists. + * + * @return the latestJobRunResourceId value. + */ + public String latestJobRunResourceId() { + return this.latestJobRunResourceId; + } + + /** + * Get the latestJobRunStatus property: The current status of the job run in a non-terminal state, if exists. + * + * @return the latestJobRunStatus value. + */ + public JobRunStatus latestJobRunStatus() { + return this.latestJobRunStatus; + } + + /** + * Get the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @return the agentName value. + */ + public String agentName() { + return this.agentName; + } + + /** + * Set the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @param agentName the agentName value to set. + * @return the JobDefinitionProperties object itself. + */ + public JobDefinitionProperties withAgentName(String agentName) { + this.agentName = agentName; + return this; + } + + /** + * Get the agentResourceId property: Fully qualified resource id of the agent to assign for new job runs of this + * definition. + * + * @return the agentResourceId value. + */ + public String agentResourceId() { + return this.agentResourceId; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceName in model JobDefinitionProperties")); + } + if (targetName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetName in model JobDefinitionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobDefinitionProperties.class); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java new file mode 100644 index 0000000000000..d5d188062601e --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.models.CopyMode; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Job definition properties. */ +@Fluent +public final class JobDefinitionUpdateProperties { + /* + * A description for the job definition. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Strategy to use for copy. + */ + @JsonProperty(value = "copyMode") + private CopyMode copyMode; + + /* + * Name of the agent to assign for new job runs of this definition. + */ + @JsonProperty(value = "agentName") + private String agentName; + + /** + * Get the description property: A description for the job definition. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the job definition. + * + * @param description the description value to set. + * @return the JobDefinitionUpdateProperties object itself. + */ + public JobDefinitionUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the copyMode property: Strategy to use for copy. + * + * @return the copyMode value. + */ + public CopyMode copyMode() { + return this.copyMode; + } + + /** + * Set the copyMode property: Strategy to use for copy. + * + * @param copyMode the copyMode value to set. + * @return the JobDefinitionUpdateProperties object itself. + */ + public JobDefinitionUpdateProperties withCopyMode(CopyMode copyMode) { + this.copyMode = copyMode; + return this; + } + + /** + * Get the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @return the agentName value. + */ + public String agentName() { + return this.agentName; + } + + /** + * Set the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @param agentName the agentName value to set. + * @return the JobDefinitionUpdateProperties object itself. + */ + public JobDefinitionUpdateProperties withAgentName(String agentName) { + this.agentName = agentName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java new file mode 100644 index 0000000000000..82f96e094ca2b --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.models.JobRunError; +import com.azure.resourcemanager.storagemover.models.JobRunScanStatus; +import com.azure.resourcemanager.storagemover.models.JobRunStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The job run resource. */ +@Fluent +public final class JobRunInner extends ProxyResource { + /* + * Job run properties. + */ + @JsonProperty(value = "properties") + private JobRunProperties innerProperties; + + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Job run properties. + * + * @return the innerProperties value. + */ + private JobRunProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the status property: The state of the job execution. + * + * @return the status value. + */ + public JobRunStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the scanStatus property: The status of agent's scanning of source. + * + * @return the scanStatus value. + */ + public JobRunScanStatus scanStatus() { + return this.innerProperties() == null ? null : this.innerProperties().scanStatus(); + } + + /** + * Get the agentName property: Name of the agent assigned to this run. + * + * @return the agentName value. + */ + public String agentName() { + return this.innerProperties() == null ? null : this.innerProperties().agentName(); + } + + /** + * Get the agentResourceId property: Fully qualified resource id of the agent assigned to this run. + * + * @return the agentResourceId value. + */ + public String agentResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().agentResourceId(); + } + + /** + * Get the executionStartTime property: Start time of the run. Null if no agent reported that the job has started. + * + * @return the executionStartTime value. + */ + public OffsetDateTime executionStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().executionStartTime(); + } + + /** + * Get the executionEndTime property: End time of the run. Null if agent has not reported that the job has ended. + * + * @return the executionEndTime value. + */ + public OffsetDateTime executionEndTime() { + return this.innerProperties() == null ? null : this.innerProperties().executionEndTime(); + } + + /** + * Get the lastUpdatedTime property: Last update time. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime(); + } + + /** + * Get the itemsScanned property: Number of items scanned so far in source. + * + * @return the itemsScanned value. + */ + public Long itemsScanned() { + return this.innerProperties() == null ? null : this.innerProperties().itemsScanned(); + } + + /** + * Get the itemsExcluded property: Number of items that will not be transferred, as they are excluded by user + * configuration. + * + * @return the itemsExcluded value. + */ + public Long itemsExcluded() { + return this.innerProperties() == null ? null : this.innerProperties().itemsExcluded(); + } + + /** + * Get the itemsUnsupported property: Number of items that will not be transferred, as they are unsupported on + * target. + * + * @return the itemsUnsupported value. + */ + public Long itemsUnsupported() { + return this.innerProperties() == null ? null : this.innerProperties().itemsUnsupported(); + } + + /** + * Get the itemsNoTransferNeeded property: Number of items that will not be transferred, as they are already found + * on target (e.g. mirror mode). + * + * @return the itemsNoTransferNeeded value. + */ + public Long itemsNoTransferNeeded() { + return this.innerProperties() == null ? null : this.innerProperties().itemsNoTransferNeeded(); + } + + /** + * Get the itemsDesignatedForTransfer property: Number of items identified for transferring so far in scan. + * + * @return the itemsDesignatedForTransfer value. + */ + public Long itemsDesignatedForTransfer() { + return this.innerProperties() == null ? null : this.innerProperties().itemsDesignatedForTransfer(); + } + + /** + * Get the itemsFailed property: Number of items that were attempted to transfer and failed. + * + * @return the itemsFailed value. + */ + public Long itemsFailed() { + return this.innerProperties() == null ? null : this.innerProperties().itemsFailed(); + } + + /** + * Get the itemsTransferred property: Number of items successfully transferred to target. + * + * @return the itemsTransferred value. + */ + public Long itemsTransferred() { + return this.innerProperties() == null ? null : this.innerProperties().itemsTransferred(); + } + + /** + * Get the bytesScanned property: Bytes of data scanned so far in source. + * + * @return the bytesScanned value. + */ + public Long bytesScanned() { + return this.innerProperties() == null ? null : this.innerProperties().bytesScanned(); + } + + /** + * Get the bytesExcluded property: Bytes of data that will not be transferred, as they are excluded by user + * configuration. + * + * @return the bytesExcluded value. + */ + public Long bytesExcluded() { + return this.innerProperties() == null ? null : this.innerProperties().bytesExcluded(); + } + + /** + * Get the bytesUnsupported property: Bytes of data that will not be transferred, as they are unsupported on target. + * + * @return the bytesUnsupported value. + */ + public Long bytesUnsupported() { + return this.innerProperties() == null ? null : this.innerProperties().bytesUnsupported(); + } + + /** + * Get the bytesNoTransferNeeded property: Bytes of data that will not be transferred, as they are already found on + * target (e.g. mirror mode). + * + * @return the bytesNoTransferNeeded value. + */ + public Long bytesNoTransferNeeded() { + return this.innerProperties() == null ? null : this.innerProperties().bytesNoTransferNeeded(); + } + + /** + * Get the bytesDesignatedForTransfer property: Bytes of data identified for transferring so far in scan. + * + * @return the bytesDesignatedForTransfer value. + */ + public Long bytesDesignatedForTransfer() { + return this.innerProperties() == null ? null : this.innerProperties().bytesDesignatedForTransfer(); + } + + /** + * Get the bytesFailed property: Bytes of data that were attempted to transfer and failed. + * + * @return the bytesFailed value. + */ + public Long bytesFailed() { + return this.innerProperties() == null ? null : this.innerProperties().bytesFailed(); + } + + /** + * Get the bytesTransferred property: Bytes of data successfully transferred to target. + * + * @return the bytesTransferred value. + */ + public Long bytesTransferred() { + return this.innerProperties() == null ? null : this.innerProperties().bytesTransferred(); + } + + /** + * Get the sourceName property: Name of source Endpoint resource. This resource may no longer exist. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceName(); + } + + /** + * Get the sourceResourceId property: Fully qualified resource id of source Endpoint. This id may no longer exist. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Get the sourceProperties property: Copy of source Endpoint resource's properties at time of Job Run creation. + * + * @return the sourceProperties value. + */ + public Object sourceProperties() { + return this.innerProperties() == null ? null : this.innerProperties().sourceProperties(); + } + + /** + * Get the targetName property: Name of target Endpoint resource. This resource may no longer exist. + * + * @return the targetName value. + */ + public String targetName() { + return this.innerProperties() == null ? null : this.innerProperties().targetName(); + } + + /** + * Get the targetResourceId property: Fully qualified resource id of of Endpoint. This id may no longer exist. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceId(); + } + + /** + * Get the targetProperties property: Copy of Endpoint resource's properties at time of Job Run creation. + * + * @return the targetProperties value. + */ + public Object targetProperties() { + return this.innerProperties() == null ? null : this.innerProperties().targetProperties(); + } + + /** + * Get the jobDefinitionProperties property: Copy of parent Job Definition's properties at time of Job Run creation. + * + * @return the jobDefinitionProperties value. + */ + public Object jobDefinitionProperties() { + return this.innerProperties() == null ? null : this.innerProperties().jobDefinitionProperties(); + } + + /** + * Get the error property: Error details. + * + * @return the error value. + */ + public JobRunError error() { + return this.innerProperties() == null ? null : this.innerProperties().error(); + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java new file mode 100644 index 0000000000000..28cd56c47f749 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.models.JobRunError; +import com.azure.resourcemanager.storagemover.models.JobRunScanStatus; +import com.azure.resourcemanager.storagemover.models.JobRunStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Job run properties. */ +@Immutable +public final class JobRunProperties { + /* + * The state of the job execution. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private JobRunStatus status; + + /* + * The status of agent's scanning of source. + */ + @JsonProperty(value = "scanStatus", access = JsonProperty.Access.WRITE_ONLY) + private JobRunScanStatus scanStatus; + + /* + * Name of the agent assigned to this run. + */ + @JsonProperty(value = "agentName", access = JsonProperty.Access.WRITE_ONLY) + private String agentName; + + /* + * Fully qualified resource id of the agent assigned to this run. + */ + @JsonProperty(value = "agentResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String agentResourceId; + + /* + * Start time of the run. Null if no agent reported that the job has + * started. + */ + @JsonProperty(value = "executionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime executionStartTime; + + /* + * End time of the run. Null if agent has not reported that the job has + * ended. + */ + @JsonProperty(value = "executionEndTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime executionEndTime; + + /* + * Last update time. + */ + @JsonProperty(value = "lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * Number of items scanned so far in source. + */ + @JsonProperty(value = "itemsScanned", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsScanned; + + /* + * Number of items that will not be transferred, as they are excluded by + * user configuration. + */ + @JsonProperty(value = "itemsExcluded", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsExcluded; + + /* + * Number of items that will not be transferred, as they are unsupported on + * target. + */ + @JsonProperty(value = "itemsUnsupported", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsUnsupported; + + /* + * Number of items that will not be transferred, as they are already found + * on target (e.g. mirror mode). + */ + @JsonProperty(value = "itemsNoTransferNeeded", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsNoTransferNeeded; + + /* + * Number of items identified for transferring so far in scan. + */ + @JsonProperty(value = "itemsDesignatedForTransfer", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsDesignatedForTransfer; + + /* + * Number of items that were attempted to transfer and failed. + */ + @JsonProperty(value = "itemsFailed", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsFailed; + + /* + * Number of items successfully transferred to target. + */ + @JsonProperty(value = "itemsTransferred", access = JsonProperty.Access.WRITE_ONLY) + private Long itemsTransferred; + + /* + * Bytes of data scanned so far in source. + */ + @JsonProperty(value = "bytesScanned", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesScanned; + + /* + * Bytes of data that will not be transferred, as they are excluded by user + * configuration. + */ + @JsonProperty(value = "bytesExcluded", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesExcluded; + + /* + * Bytes of data that will not be transferred, as they are unsupported on + * target. + */ + @JsonProperty(value = "bytesUnsupported", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesUnsupported; + + /* + * Bytes of data that will not be transferred, as they are already found on + * target (e.g. mirror mode). + */ + @JsonProperty(value = "bytesNoTransferNeeded", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesNoTransferNeeded; + + /* + * Bytes of data identified for transferring so far in scan. + */ + @JsonProperty(value = "bytesDesignatedForTransfer", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesDesignatedForTransfer; + + /* + * Bytes of data that were attempted to transfer and failed. + */ + @JsonProperty(value = "bytesFailed", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesFailed; + + /* + * Bytes of data successfully transferred to target. + */ + @JsonProperty(value = "bytesTransferred", access = JsonProperty.Access.WRITE_ONLY) + private Long bytesTransferred; + + /* + * Name of source Endpoint resource. This resource may no longer exist. + */ + @JsonProperty(value = "sourceName", access = JsonProperty.Access.WRITE_ONLY) + private String sourceName; + + /* + * Fully qualified resource id of source Endpoint. This id may no longer + * exist. + */ + @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceId; + + /* + * Copy of source Endpoint resource's properties at time of Job Run + * creation. + */ + @JsonProperty(value = "sourceProperties", access = JsonProperty.Access.WRITE_ONLY) + private Object sourceProperties; + + /* + * Name of target Endpoint resource. This resource may no longer exist. + */ + @JsonProperty(value = "targetName", access = JsonProperty.Access.WRITE_ONLY) + private String targetName; + + /* + * Fully qualified resource id of of Endpoint. This id may no longer exist. + */ + @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceId; + + /* + * Copy of Endpoint resource's properties at time of Job Run creation. + */ + @JsonProperty(value = "targetProperties", access = JsonProperty.Access.WRITE_ONLY) + private Object targetProperties; + + /* + * Copy of parent Job Definition's properties at time of Job Run creation. + */ + @JsonProperty(value = "jobDefinitionProperties", access = JsonProperty.Access.WRITE_ONLY) + private Object jobDefinitionProperties; + + /* + * Error details. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private JobRunError error; + + /* + * The provisioning state of this resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the status property: The state of the job execution. + * + * @return the status value. + */ + public JobRunStatus status() { + return this.status; + } + + /** + * Get the scanStatus property: The status of agent's scanning of source. + * + * @return the scanStatus value. + */ + public JobRunScanStatus scanStatus() { + return this.scanStatus; + } + + /** + * Get the agentName property: Name of the agent assigned to this run. + * + * @return the agentName value. + */ + public String agentName() { + return this.agentName; + } + + /** + * Get the agentResourceId property: Fully qualified resource id of the agent assigned to this run. + * + * @return the agentResourceId value. + */ + public String agentResourceId() { + return this.agentResourceId; + } + + /** + * Get the executionStartTime property: Start time of the run. Null if no agent reported that the job has started. + * + * @return the executionStartTime value. + */ + public OffsetDateTime executionStartTime() { + return this.executionStartTime; + } + + /** + * Get the executionEndTime property: End time of the run. Null if agent has not reported that the job has ended. + * + * @return the executionEndTime value. + */ + public OffsetDateTime executionEndTime() { + return this.executionEndTime; + } + + /** + * Get the lastUpdatedTime property: Last update time. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the itemsScanned property: Number of items scanned so far in source. + * + * @return the itemsScanned value. + */ + public Long itemsScanned() { + return this.itemsScanned; + } + + /** + * Get the itemsExcluded property: Number of items that will not be transferred, as they are excluded by user + * configuration. + * + * @return the itemsExcluded value. + */ + public Long itemsExcluded() { + return this.itemsExcluded; + } + + /** + * Get the itemsUnsupported property: Number of items that will not be transferred, as they are unsupported on + * target. + * + * @return the itemsUnsupported value. + */ + public Long itemsUnsupported() { + return this.itemsUnsupported; + } + + /** + * Get the itemsNoTransferNeeded property: Number of items that will not be transferred, as they are already found + * on target (e.g. mirror mode). + * + * @return the itemsNoTransferNeeded value. + */ + public Long itemsNoTransferNeeded() { + return this.itemsNoTransferNeeded; + } + + /** + * Get the itemsDesignatedForTransfer property: Number of items identified for transferring so far in scan. + * + * @return the itemsDesignatedForTransfer value. + */ + public Long itemsDesignatedForTransfer() { + return this.itemsDesignatedForTransfer; + } + + /** + * Get the itemsFailed property: Number of items that were attempted to transfer and failed. + * + * @return the itemsFailed value. + */ + public Long itemsFailed() { + return this.itemsFailed; + } + + /** + * Get the itemsTransferred property: Number of items successfully transferred to target. + * + * @return the itemsTransferred value. + */ + public Long itemsTransferred() { + return this.itemsTransferred; + } + + /** + * Get the bytesScanned property: Bytes of data scanned so far in source. + * + * @return the bytesScanned value. + */ + public Long bytesScanned() { + return this.bytesScanned; + } + + /** + * Get the bytesExcluded property: Bytes of data that will not be transferred, as they are excluded by user + * configuration. + * + * @return the bytesExcluded value. + */ + public Long bytesExcluded() { + return this.bytesExcluded; + } + + /** + * Get the bytesUnsupported property: Bytes of data that will not be transferred, as they are unsupported on target. + * + * @return the bytesUnsupported value. + */ + public Long bytesUnsupported() { + return this.bytesUnsupported; + } + + /** + * Get the bytesNoTransferNeeded property: Bytes of data that will not be transferred, as they are already found on + * target (e.g. mirror mode). + * + * @return the bytesNoTransferNeeded value. + */ + public Long bytesNoTransferNeeded() { + return this.bytesNoTransferNeeded; + } + + /** + * Get the bytesDesignatedForTransfer property: Bytes of data identified for transferring so far in scan. + * + * @return the bytesDesignatedForTransfer value. + */ + public Long bytesDesignatedForTransfer() { + return this.bytesDesignatedForTransfer; + } + + /** + * Get the bytesFailed property: Bytes of data that were attempted to transfer and failed. + * + * @return the bytesFailed value. + */ + public Long bytesFailed() { + return this.bytesFailed; + } + + /** + * Get the bytesTransferred property: Bytes of data successfully transferred to target. + * + * @return the bytesTransferred value. + */ + public Long bytesTransferred() { + return this.bytesTransferred; + } + + /** + * Get the sourceName property: Name of source Endpoint resource. This resource may no longer exist. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.sourceName; + } + + /** + * Get the sourceResourceId property: Fully qualified resource id of source Endpoint. This id may no longer exist. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the sourceProperties property: Copy of source Endpoint resource's properties at time of Job Run creation. + * + * @return the sourceProperties value. + */ + public Object sourceProperties() { + return this.sourceProperties; + } + + /** + * Get the targetName property: Name of target Endpoint resource. This resource may no longer exist. + * + * @return the targetName value. + */ + public String targetName() { + return this.targetName; + } + + /** + * Get the targetResourceId property: Fully qualified resource id of of Endpoint. This id may no longer exist. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Get the targetProperties property: Copy of Endpoint resource's properties at time of Job Run creation. + * + * @return the targetProperties value. + */ + public Object targetProperties() { + return this.targetProperties; + } + + /** + * Get the jobDefinitionProperties property: Copy of parent Job Definition's properties at time of Job Run creation. + * + * @return the jobDefinitionProperties value. + */ + public Object jobDefinitionProperties() { + return this.jobDefinitionProperties; + } + + /** + * Get the error property: Error details. + * + * @return the error value. + */ + public JobRunError error() { + return this.error; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java new file mode 100644 index 0000000000000..17d023dc13c09 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response that identifies a JobRun. */ +@Immutable +public final class JobRunResourceIdInner { + /* + * Fully qualified resource id of the JobRun. + */ + @JsonProperty(value = "jobRunResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String jobRunResourceId; + + /** + * Get the jobRunResourceId property: Fully qualified resource id of the JobRun. + * + * @return the jobRunResourceId value. + */ + public String jobRunResourceId() { + return this.jobRunResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..daa20f8b8e772 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.models.ActionType; +import com.azure.resourcemanager.storagemover.models.OperationDisplay; +import com.azure.resourcemanager.storagemover.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API Operation Details of a REST API operation, returned from the Resource Provider Operations API. */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). + * Examples: "Microsoft.Compute/virtualMachines/write", + * "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for + * data-plane operations and "false" for ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access + * Control (RBAC) and audit logs UX. Default value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java new file mode 100644 index 0000000000000..b2a7209865412 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The project resource. */ +@Fluent +public final class ProjectInner extends ProxyResource { + /* + * Project properties. + */ + @JsonProperty(value = "properties") + private ProjectProperties innerProperties; + + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Project properties. + * + * @return the innerProperties value. + */ + private ProjectProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the description property: A description for the project. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the project. + * + * @param description the description value to set. + * @return the ProjectInner object itself. + */ + public ProjectInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java new file mode 100644 index 0000000000000..6c434d43a4199 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Project properties. */ +@Fluent +public final class ProjectProperties { + /* + * A description for the project. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The provisioning state of this resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the description property: A description for the project. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the project. + * + * @param description the description value to set. + * @return the ProjectProperties object itself. + */ + public ProjectProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java new file mode 100644 index 0000000000000..4273d1c1cb16b --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Project properties. */ +@Fluent +public final class ProjectUpdateProperties { + /* + * A description for the project. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the description property: A description for the project. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the project. + * + * @param description the description value to set. + * @return the ProjectUpdateProperties object itself. + */ + public ProjectUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java new file mode 100644 index 0000000000000..241282186d369 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Storage Mover resource, which is a container for a group of Storage Mover agents and projects. */ +@Fluent +public final class StorageMoverInner extends Resource { + /* + * The resource specific properties for the Storage Mover resource. + */ + @JsonProperty(value = "properties") + private StorageMoverProperties innerProperties; + + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: The resource specific properties for the Storage Mover resource. + * + * @return the innerProperties value. + */ + private StorageMoverProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public StorageMoverInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public StorageMoverInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: A description for the Storage Mover. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the Storage Mover. + * + * @param description the description value to set. + * @return the StorageMoverInner object itself. + */ + public StorageMoverInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageMoverProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java new file mode 100644 index 0000000000000..f45f113acb62e --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource specific properties for the Storage Mover resource. */ +@Fluent +public final class StorageMoverProperties { + /* + * A description for the Storage Mover. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The provisioning state of this resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the description property: A description for the Storage Mover. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the Storage Mover. + * + * @param description the description value to set. + * @return the StorageMoverProperties object itself. + */ + public StorageMoverProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java new file mode 100644 index 0000000000000..5b36218a69af8 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource specific properties for the Storage Mover resource. */ +@Fluent +public final class StorageMoverUpdateProperties { + /* + * A description for the Storage Mover. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the description property: A description for the Storage Mover. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the Storage Mover. + * + * @param description the description value to set. + * @return the StorageMoverUpdateProperties object itself. + */ + public StorageMoverUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java new file mode 100644 index 0000000000000..d6427e83ccee7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for StorageMoverClient. The Azure Storage Mover REST API. */ +package com.azure.resourcemanager.storagemover.fluent.models; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java new file mode 100644 index 0000000000000..8fa1b18d02bb1 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for StorageMoverClient. The Azure Storage Mover REST API. */ +package com.azure.resourcemanager.storagemover.fluent; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentImpl.java new file mode 100644 index 0000000000000..58f20dc68f1f7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; +import com.azure.resourcemanager.storagemover.models.Agent; +import com.azure.resourcemanager.storagemover.models.AgentPropertiesErrorDetails; +import com.azure.resourcemanager.storagemover.models.AgentStatus; +import com.azure.resourcemanager.storagemover.models.AgentUpdateParameters; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import java.time.OffsetDateTime; + +public final class AgentImpl implements Agent, Agent.Definition, Agent.Update { + private AgentInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public String arcResourceId() { + return this.innerModel().arcResourceId(); + } + + public String arcVmUuid() { + return this.innerModel().arcVmUuid(); + } + + public AgentStatus agentStatus() { + return this.innerModel().agentStatus(); + } + + public OffsetDateTime lastStatusUpdate() { + return this.innerModel().lastStatusUpdate(); + } + + public String localIpAddress() { + return this.innerModel().localIpAddress(); + } + + public Long memoryInMB() { + return this.innerModel().memoryInMB(); + } + + public Long numberOfCores() { + return this.innerModel().numberOfCores(); + } + + public AgentPropertiesErrorDetails errorDetails() { + return this.innerModel().errorDetails(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageMoverName; + + private String agentName; + + private AgentUpdateParameters updateAgent; + + public AgentImpl withExistingStorageMover(String resourceGroupName, String storageMoverName) { + this.resourceGroupName = resourceGroupName; + this.storageMoverName = storageMoverName; + return this; + } + + public Agent create() { + this.innerObject = + serviceManager + .serviceClient() + .getAgents() + .createOrUpdateWithResponse( + resourceGroupName, storageMoverName, agentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Agent create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAgents() + .createOrUpdateWithResponse(resourceGroupName, storageMoverName, agentName, this.innerModel(), context) + .getValue(); + return this; + } + + AgentImpl(String name, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = new AgentInner(); + this.serviceManager = serviceManager; + this.agentName = name; + } + + public AgentImpl update() { + this.updateAgent = new AgentUpdateParameters(); + return this; + } + + public Agent apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAgents() + .updateWithResponse(resourceGroupName, storageMoverName, agentName, updateAgent, Context.NONE) + .getValue(); + return this; + } + + public Agent apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAgents() + .updateWithResponse(resourceGroupName, storageMoverName, agentName, updateAgent, context) + .getValue(); + return this; + } + + AgentImpl(AgentInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageMoverName = Utils.getValueFromIdByName(innerObject.id(), "storageMovers"); + this.agentName = Utils.getValueFromIdByName(innerObject.id(), "agents"); + } + + public Agent refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAgents() + .getWithResponse(resourceGroupName, storageMoverName, agentName, Context.NONE) + .getValue(); + return this; + } + + public Agent refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAgents() + .getWithResponse(resourceGroupName, storageMoverName, agentName, context) + .getValue(); + return this; + } + + public AgentImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateAgent.withDescription(description); + return this; + } + } + + public AgentImpl withArcResourceId(String arcResourceId) { + this.innerModel().withArcResourceId(arcResourceId); + return this; + } + + public AgentImpl withArcVmUuid(String arcVmUuid) { + this.innerModel().withArcVmUuid(arcVmUuid); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java new file mode 100644 index 0000000000000..72f5ac6d8f3e3 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java @@ -0,0 +1,1180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.AgentsClient; +import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; +import com.azure.resourcemanager.storagemover.models.AgentList; +import com.azure.resourcemanager.storagemover.models.AgentUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AgentsClient. */ +public final class AgentsClientImpl implements AgentsClient { + /** The proxy service used to perform REST calls. */ + private final AgentsService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of AgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AgentsClientImpl(StorageMoverClientImpl client) { + this.service = RestProxy.create(AgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientAgents to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientAg") + private interface AgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/agents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/agents/{agentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("agentName") String agentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/agents/{agentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("agentName") String agentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AgentInner agent, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/agents/{agentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("agentName") String agentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AgentUpdateParameters agent, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/agents/{agentName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("agentName") String agentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String storageMoverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String storageMoverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageMoverName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageMoverName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageMoverName) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName)); + } + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageMoverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName, context)); + } + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String storageMoverName, String agentName) { + return getWithResponseAsync(resourceGroupName, storageMoverName, agentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentInner get(String resourceGroupName, String storageMoverName, String agentName) { + return getAsync(resourceGroupName, storageMoverName, agentName).block(); + } + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + return getWithResponseAsync(resourceGroupName, storageMoverName, agentName, context).block(); + } + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName, AgentInner agent) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + if (agent == null) { + return Mono.error(new IllegalArgumentException("Parameter agent is required and cannot be null.")); + } else { + agent.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + agent, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName, AgentInner agent, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + if (agent == null) { + return Mono.error(new IllegalArgumentException("Parameter agent is required and cannot be null.")); + } else { + agent.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + agent, + accept, + context); + } + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String storageMoverName, String agentName, AgentInner agent) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, agentName, agent) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentInner createOrUpdate( + String resourceGroupName, String storageMoverName, String agentName, AgentInner agent) { + return createOrUpdateAsync(resourceGroupName, storageMoverName, agentName, agent).block(); + } + + /** + * Creates or updates an agent resource, which references a hybrid compute machine that can run jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String storageMoverName, String agentName, AgentInner agent, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, agentName, agent, context).block(); + } + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName, AgentUpdateParameters agent) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + if (agent == null) { + return Mono.error(new IllegalArgumentException("Parameter agent is required and cannot be null.")); + } else { + agent.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + agent, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String agentName, + AgentUpdateParameters agent, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + if (agent == null) { + return Mono.error(new IllegalArgumentException("Parameter agent is required and cannot be null.")); + } else { + agent.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + agent, + accept, + context); + } + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String storageMoverName, String agentName, AgentUpdateParameters agent) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, agentName, agent) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentInner update( + String resourceGroupName, String storageMoverName, String agentName, AgentUpdateParameters agent) { + return updateAsync(resourceGroupName, storageMoverName, agentName, agent).block(); + } + + /** + * Creates or updates an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param agent The agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the agent resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String agentName, + AgentUpdateParameters agent, + Context context) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, agentName, agent, context).block(); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (agentName == null) { + return Mono.error(new IllegalArgumentException("Parameter agentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + agentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String agentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageMoverName, agentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, agentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String agentName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, agentName).getSyncPoller(); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, agentName, context).getSyncPoller(); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String storageMoverName, String agentName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, agentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, agentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, String agentName) { + deleteAsync(resourceGroupName, storageMoverName, agentName).block(); + } + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, String agentName, Context context) { + deleteAsync(resourceGroupName, storageMoverName, agentName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsImpl.java new file mode 100644 index 0000000000000..199c01f4d9ede --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.AgentsClient; +import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; +import com.azure.resourcemanager.storagemover.models.Agent; +import com.azure.resourcemanager.storagemover.models.Agents; + +public final class AgentsImpl implements Agents { + private static final ClientLogger LOGGER = new ClientLogger(AgentsImpl.class); + + private final AgentsClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public AgentsImpl( + AgentsClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String storageMoverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageMoverName); + return Utils.mapPage(inner, inner1 -> new AgentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String storageMoverName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageMoverName, context); + return Utils.mapPage(inner, inner1 -> new AgentImpl(inner1, this.manager())); + } + + public Agent get(String resourceGroupName, String storageMoverName, String agentName) { + AgentInner inner = this.serviceClient().get(resourceGroupName, storageMoverName, agentName); + if (inner != null) { + return new AgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String storageMoverName, String agentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, storageMoverName, agentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String storageMoverName, String agentName) { + this.serviceClient().delete(resourceGroupName, storageMoverName, agentName); + } + + public void delete(String resourceGroupName, String storageMoverName, String agentName, Context context) { + this.serviceClient().delete(resourceGroupName, storageMoverName, agentName, context); + } + + public Agent getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String agentName = Utils.getValueFromIdByName(id, "agents"); + if (agentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agents'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, agentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String agentName = Utils.getValueFromIdByName(id, "agents"); + if (agentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agents'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, agentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String agentName = Utils.getValueFromIdByName(id, "agents"); + if (agentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agents'.", id))); + } + this.delete(resourceGroupName, storageMoverName, agentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String agentName = Utils.getValueFromIdByName(id, "agents"); + if (agentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agents'.", id))); + } + this.delete(resourceGroupName, storageMoverName, agentName, context); + } + + private AgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + public AgentImpl define(String name) { + return new AgentImpl(name, this.manager()); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointImpl.java new file mode 100644 index 0000000000000..62b5ccfb075a7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; +import com.azure.resourcemanager.storagemover.models.Endpoint; +import com.azure.resourcemanager.storagemover.models.EndpointBaseProperties; +import com.azure.resourcemanager.storagemover.models.EndpointBaseUpdateParameters; +import com.azure.resourcemanager.storagemover.models.EndpointBaseUpdateProperties; + +public final class EndpointImpl implements Endpoint, Endpoint.Definition, Endpoint.Update { + private EndpointInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EndpointBaseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EndpointInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageMoverName; + + private String endpointName; + + private EndpointBaseUpdateParameters updateEndpointParam; + + public EndpointImpl withExistingStorageMover(String resourceGroupName, String storageMoverName) { + this.resourceGroupName = resourceGroupName; + this.storageMoverName = storageMoverName; + return this; + } + + public Endpoint create() { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .createOrUpdateWithResponse( + resourceGroupName, storageMoverName, endpointName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Endpoint create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .createOrUpdateWithResponse( + resourceGroupName, storageMoverName, endpointName, this.innerModel(), context) + .getValue(); + return this; + } + + EndpointImpl(String name, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = new EndpointInner(); + this.serviceManager = serviceManager; + this.endpointName = name; + } + + public EndpointImpl update() { + this.updateEndpointParam = new EndpointBaseUpdateParameters(); + return this; + } + + public Endpoint apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .updateWithResponse( + resourceGroupName, storageMoverName, endpointName, updateEndpointParam, Context.NONE) + .getValue(); + return this; + } + + public Endpoint apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .updateWithResponse(resourceGroupName, storageMoverName, endpointName, updateEndpointParam, context) + .getValue(); + return this; + } + + EndpointImpl(EndpointInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageMoverName = Utils.getValueFromIdByName(innerObject.id(), "storageMovers"); + this.endpointName = Utils.getValueFromIdByName(innerObject.id(), "endpoints"); + } + + public Endpoint refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .getWithResponse(resourceGroupName, storageMoverName, endpointName, Context.NONE) + .getValue(); + return this; + } + + public Endpoint refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .getWithResponse(resourceGroupName, storageMoverName, endpointName, context) + .getValue(); + return this; + } + + public EndpointImpl withProperties(EndpointBaseProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public EndpointImpl withProperties(EndpointBaseUpdateProperties properties) { + this.updateEndpointParam.withProperties(properties); + return this; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java new file mode 100644 index 0000000000000..da54d1bb6384e --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java @@ -0,0 +1,1210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.EndpointsClient; +import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; +import com.azure.resourcemanager.storagemover.models.EndpointBaseUpdateParameters; +import com.azure.resourcemanager.storagemover.models.EndpointList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EndpointsClient. */ +public final class EndpointsClientImpl implements EndpointsClient { + /** The proxy service used to perform REST calls. */ + private final EndpointsService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of EndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EndpointsClientImpl(StorageMoverClientImpl client) { + this.service = + RestProxy.create(EndpointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientEndpoints to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientEn") + private interface EndpointsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/endpoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/endpoints/{endpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("endpointName") String endpointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/endpoints/{endpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("endpointName") String endpointName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EndpointInner endpointParam, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/endpoints/{endpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("endpointName") String endpointName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EndpointBaseUpdateParameters endpointParam, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/endpoints/{endpointName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("endpointName") String endpointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String storageMoverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String storageMoverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageMoverName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageMoverName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageMoverName) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName)); + } + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageMoverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName, context)); + } + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String endpointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String storageMoverName, String endpointName) { + return getWithResponseAsync(resourceGroupName, storageMoverName, endpointName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointInner get(String resourceGroupName, String storageMoverName, String endpointName) { + return getAsync(resourceGroupName, storageMoverName, endpointName).block(); + } + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + return getWithResponseAsync(resourceGroupName, storageMoverName, endpointName, context).block(); + } + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, String endpointName, EndpointInner endpointParam) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointParam == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointParam is required and cannot be null.")); + } else { + endpointParam.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + endpointParam, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointInner endpointParam, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointParam == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointParam is required and cannot be null.")); + } else { + endpointParam.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + endpointParam, + accept, + context); + } + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String storageMoverName, String endpointName, EndpointInner endpointParam) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, endpointName, endpointParam) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointInner createOrUpdate( + String resourceGroupName, String storageMoverName, String endpointName, EndpointInner endpointParam) { + return createOrUpdateAsync(resourceGroupName, storageMoverName, endpointName, endpointParam).block(); + } + + /** + * Creates or updates an endpoint resource, which represents a data transfer source or destination. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource, which contains information about file sources and targets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointInner endpointParam, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, storageMoverName, endpointName, endpointParam, context) + .block(); + } + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointParam == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointParam is required and cannot be null.")); + } else { + endpointParam.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + endpointParam, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointParam == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointParam is required and cannot be null.")); + } else { + endpointParam.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + endpointParam, + accept, + context); + } + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, endpointName, endpointParam) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointInner update( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam) { + return updateAsync(resourceGroupName, storageMoverName, endpointName, endpointParam).block(); + } + + /** + * Updates properties for an endpoint resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param endpointParam The endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint resource, which contains information about file sources and targets along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String endpointName, + EndpointBaseUpdateParameters endpointParam, + Context context) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, endpointName, endpointParam, context) + .block(); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String endpointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + endpointName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String endpointName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, endpointName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, endpointName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String endpointName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, endpointName).getSyncPoller(); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, endpointName, context).getSyncPoller(); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String storageMoverName, String endpointName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, endpointName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, endpointName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, String endpointName) { + deleteAsync(resourceGroupName, storageMoverName, endpointName).block(); + } + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, String endpointName, Context context) { + deleteAsync(resourceGroupName, storageMoverName, endpointName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsImpl.java new file mode 100644 index 0000000000000..179c9cf3d864d --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.EndpointsClient; +import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; +import com.azure.resourcemanager.storagemover.models.Endpoint; +import com.azure.resourcemanager.storagemover.models.Endpoints; + +public final class EndpointsImpl implements Endpoints { + private static final ClientLogger LOGGER = new ClientLogger(EndpointsImpl.class); + + private final EndpointsClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public EndpointsImpl( + EndpointsClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String storageMoverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageMoverName); + return Utils.mapPage(inner, inner1 -> new EndpointImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String storageMoverName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageMoverName, context); + return Utils.mapPage(inner, inner1 -> new EndpointImpl(inner1, this.manager())); + } + + public Endpoint get(String resourceGroupName, String storageMoverName, String endpointName) { + EndpointInner inner = this.serviceClient().get(resourceGroupName, storageMoverName, endpointName); + if (inner != null) { + return new EndpointImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String storageMoverName, String endpointName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, storageMoverName, endpointName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EndpointImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String storageMoverName, String endpointName) { + this.serviceClient().delete(resourceGroupName, storageMoverName, endpointName); + } + + public void delete(String resourceGroupName, String storageMoverName, String endpointName, Context context) { + this.serviceClient().delete(resourceGroupName, storageMoverName, endpointName, context); + } + + public Endpoint getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String endpointName = Utils.getValueFromIdByName(id, "endpoints"); + if (endpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, endpointName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String endpointName = Utils.getValueFromIdByName(id, "endpoints"); + if (endpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, endpointName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String endpointName = Utils.getValueFromIdByName(id, "endpoints"); + if (endpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + this.delete(resourceGroupName, storageMoverName, endpointName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String endpointName = Utils.getValueFromIdByName(id, "endpoints"); + if (endpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + this.delete(resourceGroupName, storageMoverName, endpointName, context); + } + + private EndpointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + public EndpointImpl define(String name) { + return new EndpointImpl(name, this.manager()); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionImpl.java new file mode 100644 index 0000000000000..19cddbe6ff428 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionImpl.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.storagemover.models.CopyMode; +import com.azure.resourcemanager.storagemover.models.JobDefinition; +import com.azure.resourcemanager.storagemover.models.JobDefinitionUpdateParameters; +import com.azure.resourcemanager.storagemover.models.JobRunResourceId; +import com.azure.resourcemanager.storagemover.models.JobRunStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; + +public final class JobDefinitionImpl implements JobDefinition, JobDefinition.Definition, JobDefinition.Update { + private JobDefinitionInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public CopyMode copyMode() { + return this.innerModel().copyMode(); + } + + public String sourceName() { + return this.innerModel().sourceName(); + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + public String sourceSubpath() { + return this.innerModel().sourceSubpath(); + } + + public String targetName() { + return this.innerModel().targetName(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public String targetSubpath() { + return this.innerModel().targetSubpath(); + } + + public String latestJobRunName() { + return this.innerModel().latestJobRunName(); + } + + public String latestJobRunResourceId() { + return this.innerModel().latestJobRunResourceId(); + } + + public JobRunStatus latestJobRunStatus() { + return this.innerModel().latestJobRunStatus(); + } + + public String agentName() { + return this.innerModel().agentName(); + } + + public String agentResourceId() { + return this.innerModel().agentResourceId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JobDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageMoverName; + + private String projectName; + + private String jobDefinitionName; + + private JobDefinitionUpdateParameters updateJobDefinition; + + public JobDefinitionImpl withExistingProject( + String resourceGroupName, String storageMoverName, String projectName) { + this.resourceGroupName = resourceGroupName; + this.storageMoverName = storageMoverName; + this.projectName = projectName; + return this; + } + + public JobDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobDefinitions() + .createOrUpdateWithResponse( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public JobDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobDefinitions() + .createOrUpdateWithResponse( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, this.innerModel(), context) + .getValue(); + return this; + } + + JobDefinitionImpl(String name, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = new JobDefinitionInner(); + this.serviceManager = serviceManager; + this.jobDefinitionName = name; + } + + public JobDefinitionImpl update() { + this.updateJobDefinition = new JobDefinitionUpdateParameters(); + return this; + } + + public JobDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobDefinitions() + .updateWithResponse( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + updateJobDefinition, + Context.NONE) + .getValue(); + return this; + } + + public JobDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobDefinitions() + .updateWithResponse( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, updateJobDefinition, context) + .getValue(); + return this; + } + + JobDefinitionImpl( + JobDefinitionInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageMoverName = Utils.getValueFromIdByName(innerObject.id(), "storageMovers"); + this.projectName = Utils.getValueFromIdByName(innerObject.id(), "projects"); + this.jobDefinitionName = Utils.getValueFromIdByName(innerObject.id(), "jobDefinitions"); + } + + public JobDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobDefinitions() + .getWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, Context.NONE) + .getValue(); + return this; + } + + public JobDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobDefinitions() + .getWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context) + .getValue(); + return this; + } + + public JobRunResourceId startJob() { + return serviceManager + .jobDefinitions() + .startJob(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + } + + public Response startJobWithResponse(Context context) { + return serviceManager + .jobDefinitions() + .startJobWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + } + + public JobRunResourceId stopJob() { + return serviceManager + .jobDefinitions() + .stopJob(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + } + + public Response stopJobWithResponse(Context context) { + return serviceManager + .jobDefinitions() + .stopJobWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + } + + public JobDefinitionImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateJobDefinition.withDescription(description); + return this; + } + } + + public JobDefinitionImpl withCopyMode(CopyMode copyMode) { + if (isInCreateMode()) { + this.innerModel().withCopyMode(copyMode); + return this; + } else { + this.updateJobDefinition.withCopyMode(copyMode); + return this; + } + } + + public JobDefinitionImpl withSourceName(String sourceName) { + this.innerModel().withSourceName(sourceName); + return this; + } + + public JobDefinitionImpl withSourceSubpath(String sourceSubpath) { + this.innerModel().withSourceSubpath(sourceSubpath); + return this; + } + + public JobDefinitionImpl withTargetName(String targetName) { + this.innerModel().withTargetName(targetName); + return this; + } + + public JobDefinitionImpl withTargetSubpath(String targetSubpath) { + this.innerModel().withTargetSubpath(targetSubpath); + return this; + } + + public JobDefinitionImpl withAgentName(String agentName) { + if (isInCreateMode()) { + this.innerModel().withAgentName(agentName); + return this; + } else { + this.updateJobDefinition.withAgentName(agentName); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java new file mode 100644 index 0000000000000..8846a63926010 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java @@ -0,0 +1,1757 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.JobDefinitionsClient; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunResourceIdInner; +import com.azure.resourcemanager.storagemover.models.JobDefinitionList; +import com.azure.resourcemanager.storagemover.models.JobDefinitionUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobDefinitionsClient. */ +public final class JobDefinitionsClientImpl implements JobDefinitionsClient { + /** The proxy service used to perform REST calls. */ + private final JobDefinitionsService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of JobDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobDefinitionsClientImpl(StorageMoverClientImpl client) { + this.service = + RestProxy.create(JobDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientJobDefinitions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientJo") + private interface JobDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobDefinitionInner jobDefinition, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobDefinitionUpdateParameters jobDefinition, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}" + + "/startJob") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> startJob( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/stopJob") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> stopJob( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String storageMoverName, String projectName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String storageMoverName, String projectName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, projectName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, projectName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName, projectName)); + } + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName, projectName, context)); + } + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return getWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobDefinitionInner get( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return getAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName).block(); + } + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return getWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context) + .block(); + } + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + if (jobDefinition == null) { + return Mono.error(new IllegalArgumentException("Parameter jobDefinition is required and cannot be null.")); + } else { + jobDefinition.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + jobDefinition, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + if (jobDefinition == null) { + return Mono.error(new IllegalArgumentException("Parameter jobDefinition is required and cannot be null.")); + } else { + jobDefinition.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + jobDefinition, + accept, + context); + } + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition) { + return createOrUpdateWithResponseAsync( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobDefinition) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobDefinitionInner createOrUpdate( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition) { + return createOrUpdateAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobDefinition) + .block(); + } + + /** + * Creates or updates a job definition resource, which contains configuration for a single unit of managed data + * transfer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionInner jobDefinition, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobDefinition, context) + .block(); + } + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + if (jobDefinition == null) { + return Mono.error(new IllegalArgumentException("Parameter jobDefinition is required and cannot be null.")); + } else { + jobDefinition.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + jobDefinition, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + if (jobDefinition == null) { + return Mono.error(new IllegalArgumentException("Parameter jobDefinition is required and cannot be null.")); + } else { + jobDefinition.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + jobDefinition, + accept, + context); + } + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition) { + return updateWithResponseAsync( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobDefinition) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobDefinitionInner update( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition) { + return updateAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobDefinition).block(); + } + + /** + * Updates properties for a job definition resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobDefinition The job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the job definition resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + JobDefinitionUpdateParameters jobDefinition, + Context context) { + return updateWithResponseAsync( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobDefinition, context) + .block(); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName).getSyncPoller(); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context) + .getSyncPoller(); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + deleteAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName).block(); + } + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + deleteAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context).block(); + } + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startJobWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .startJob( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startJobWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .startJob( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startJobAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return startJobWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobRunResourceIdInner startJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return startJobAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName).block(); + } + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return startJobWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context) + .block(); + } + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> stopJobWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stopJob( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> stopJobWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stopJob( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopJobAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return stopJobWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobRunResourceIdInner stopJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return stopJobAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName).block(); + } + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return stopJobWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsImpl.java new file mode 100644 index 0000000000000..9624f2197c260 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.JobDefinitionsClient; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunResourceIdInner; +import com.azure.resourcemanager.storagemover.models.JobDefinition; +import com.azure.resourcemanager.storagemover.models.JobDefinitions; +import com.azure.resourcemanager.storagemover.models.JobRunResourceId; + +public final class JobDefinitionsImpl implements JobDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(JobDefinitionsImpl.class); + + private final JobDefinitionsClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public JobDefinitionsImpl( + JobDefinitionsClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String storageMoverName, String projectName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, storageMoverName, projectName); + return Utils.mapPage(inner, inner1 -> new JobDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, storageMoverName, projectName, context); + return Utils.mapPage(inner, inner1 -> new JobDefinitionImpl(inner1, this.manager())); + } + + public JobDefinition get( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + JobDefinitionInner inner = + this.serviceClient().get(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + if (inner != null) { + return new JobDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + this.serviceClient().delete(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + } + + public void delete( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + this.serviceClient().delete(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + } + + public JobRunResourceId startJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + JobRunResourceIdInner inner = + this.serviceClient().startJob(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + if (inner != null) { + return new JobRunResourceIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response startJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + Response inner = + this + .serviceClient() + .startJobWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobRunResourceIdImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobRunResourceId stopJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + JobRunResourceIdInner inner = + this.serviceClient().stopJob(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + if (inner != null) { + return new JobRunResourceIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response stopJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + Response inner = + this + .serviceClient() + .stopJobWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobRunResourceIdImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobDefinition getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String jobDefinitionName = Utils.getValueFromIdByName(id, "jobDefinitions"); + if (jobDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobDefinitions'.", id))); + } + return this + .getWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String jobDefinitionName = Utils.getValueFromIdByName(id, "jobDefinitions"); + if (jobDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobDefinitions'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String jobDefinitionName = Utils.getValueFromIdByName(id, "jobDefinitions"); + if (jobDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobDefinitions'.", id))); + } + this.delete(resourceGroupName, storageMoverName, projectName, jobDefinitionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String jobDefinitionName = Utils.getValueFromIdByName(id, "jobDefinitions"); + if (jobDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobDefinitions'.", id))); + } + this.delete(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + } + + private JobDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + public JobDefinitionImpl define(String name) { + return new JobDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunImpl.java new file mode 100644 index 0000000000000..b3c7c21ad5325 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; +import com.azure.resourcemanager.storagemover.models.JobRun; +import com.azure.resourcemanager.storagemover.models.JobRunError; +import com.azure.resourcemanager.storagemover.models.JobRunScanStatus; +import com.azure.resourcemanager.storagemover.models.JobRunStatus; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import java.time.OffsetDateTime; + +public final class JobRunImpl implements JobRun { + private JobRunInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + JobRunImpl(JobRunInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public JobRunStatus status() { + return this.innerModel().status(); + } + + public JobRunScanStatus scanStatus() { + return this.innerModel().scanStatus(); + } + + public String agentName() { + return this.innerModel().agentName(); + } + + public String agentResourceId() { + return this.innerModel().agentResourceId(); + } + + public OffsetDateTime executionStartTime() { + return this.innerModel().executionStartTime(); + } + + public OffsetDateTime executionEndTime() { + return this.innerModel().executionEndTime(); + } + + public OffsetDateTime lastUpdatedTime() { + return this.innerModel().lastUpdatedTime(); + } + + public Long itemsScanned() { + return this.innerModel().itemsScanned(); + } + + public Long itemsExcluded() { + return this.innerModel().itemsExcluded(); + } + + public Long itemsUnsupported() { + return this.innerModel().itemsUnsupported(); + } + + public Long itemsNoTransferNeeded() { + return this.innerModel().itemsNoTransferNeeded(); + } + + public Long itemsDesignatedForTransfer() { + return this.innerModel().itemsDesignatedForTransfer(); + } + + public Long itemsFailed() { + return this.innerModel().itemsFailed(); + } + + public Long itemsTransferred() { + return this.innerModel().itemsTransferred(); + } + + public Long bytesScanned() { + return this.innerModel().bytesScanned(); + } + + public Long bytesExcluded() { + return this.innerModel().bytesExcluded(); + } + + public Long bytesUnsupported() { + return this.innerModel().bytesUnsupported(); + } + + public Long bytesNoTransferNeeded() { + return this.innerModel().bytesNoTransferNeeded(); + } + + public Long bytesDesignatedForTransfer() { + return this.innerModel().bytesDesignatedForTransfer(); + } + + public Long bytesFailed() { + return this.innerModel().bytesFailed(); + } + + public Long bytesTransferred() { + return this.innerModel().bytesTransferred(); + } + + public String sourceName() { + return this.innerModel().sourceName(); + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + public Object sourceProperties() { + return this.innerModel().sourceProperties(); + } + + public String targetName() { + return this.innerModel().targetName(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public Object targetProperties() { + return this.innerModel().targetProperties(); + } + + public Object jobDefinitionProperties() { + return this.innerModel().jobDefinitionProperties(); + } + + public JobRunError error() { + return this.innerModel().error(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public JobRunInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunResourceIdImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunResourceIdImpl.java new file mode 100644 index 0000000000000..c4c239df460cf --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunResourceIdImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.resourcemanager.storagemover.fluent.models.JobRunResourceIdInner; +import com.azure.resourcemanager.storagemover.models.JobRunResourceId; + +public final class JobRunResourceIdImpl implements JobRunResourceId { + private JobRunResourceIdInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + JobRunResourceIdImpl( + JobRunResourceIdInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String jobRunResourceId() { + return this.innerModel().jobRunResourceId(); + } + + public JobRunResourceIdInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java new file mode 100644 index 0000000000000..bd870451f6c95 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java @@ -0,0 +1,613 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.storagemover.fluent.JobRunsClient; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; +import com.azure.resourcemanager.storagemover.models.JobRunList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobRunsClient. */ +public final class JobRunsClientImpl implements JobRunsClient { + /** The proxy service used to perform REST calls. */ + private final JobRunsService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of JobRunsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobRunsClientImpl(StorageMoverClientImpl client) { + this.service = RestProxy.create(JobRunsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientJobRuns to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientJo") + private interface JobRunsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns" + + "/{jobRunName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @PathParam("jobDefinitionName") String jobDefinitionName, + @PathParam("jobRunName") String jobRunName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName)); + } + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context)); + } + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + if (jobRunName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobRunName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobRunName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (jobDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobDefinitionName is required and cannot be null.")); + } + if (jobRunName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobRunName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobRunName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName) { + return getWithResponseAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobRunName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobRunInner get( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName) { + return getAsync(resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobRunName).block(); + } + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName, + Context context) { + return getWithResponseAsync( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobRunName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsImpl.java new file mode 100644 index 0000000000000..685e20ef71044 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.JobRunsClient; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; +import com.azure.resourcemanager.storagemover.models.JobRun; +import com.azure.resourcemanager.storagemover.models.JobRuns; + +public final class JobRunsImpl implements JobRuns { + private static final ClientLogger LOGGER = new ClientLogger(JobRunsImpl.class); + + private final JobRunsClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public JobRunsImpl( + JobRunsClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, storageMoverName, projectName, jobDefinitionName); + return Utils.mapPage(inner, inner1 -> new JobRunImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, storageMoverName, projectName, jobDefinitionName, context); + return Utils.mapPage(inner, inner1 -> new JobRunImpl(inner1, this.manager())); + } + + public JobRun get( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName) { + JobRunInner inner = + this.serviceClient().get(resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobRunName); + if (inner != null) { + return new JobRunImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, storageMoverName, projectName, jobDefinitionName, jobRunName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobRunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private JobRunsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationImpl.java new file mode 100644 index 0000000000000..dc9a76866edb8 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; +import com.azure.resourcemanager.storagemover.models.ActionType; +import com.azure.resourcemanager.storagemover.models.Operation; +import com.azure.resourcemanager.storagemover.models.OperationDisplay; +import com.azure.resourcemanager.storagemover.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..f5d47b8588096 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.storagemover.fluent.OperationsClient; +import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; +import com.azure.resourcemanager.storagemover.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(StorageMoverClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientOp") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.StorageMover/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..b3c92b15b184c --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.OperationsClient; +import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; +import com.azure.resourcemanager.storagemover.models.Operation; +import com.azure.resourcemanager.storagemover.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectImpl.java new file mode 100644 index 0000000000000..ad312e4131a67 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; +import com.azure.resourcemanager.storagemover.models.Project; +import com.azure.resourcemanager.storagemover.models.ProjectUpdateParameters; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; + +public final class ProjectImpl implements Project, Project.Definition, Project.Update { + private ProjectInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ProjectInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageMoverName; + + private String projectName; + + private ProjectUpdateParameters updateProject; + + public ProjectImpl withExistingStorageMover(String resourceGroupName, String storageMoverName) { + this.resourceGroupName = resourceGroupName; + this.storageMoverName = storageMoverName; + return this; + } + + public Project create() { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .createOrUpdateWithResponse( + resourceGroupName, storageMoverName, projectName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Project create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .createOrUpdateWithResponse( + resourceGroupName, storageMoverName, projectName, this.innerModel(), context) + .getValue(); + return this; + } + + ProjectImpl(String name, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = new ProjectInner(); + this.serviceManager = serviceManager; + this.projectName = name; + } + + public ProjectImpl update() { + this.updateProject = new ProjectUpdateParameters(); + return this; + } + + public Project apply() { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .updateWithResponse(resourceGroupName, storageMoverName, projectName, updateProject, Context.NONE) + .getValue(); + return this; + } + + public Project apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .updateWithResponse(resourceGroupName, storageMoverName, projectName, updateProject, context) + .getValue(); + return this; + } + + ProjectImpl(ProjectInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageMoverName = Utils.getValueFromIdByName(innerObject.id(), "storageMovers"); + this.projectName = Utils.getValueFromIdByName(innerObject.id(), "projects"); + } + + public Project refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .getWithResponse(resourceGroupName, storageMoverName, projectName, Context.NONE) + .getValue(); + return this; + } + + public Project refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .getWithResponse(resourceGroupName, storageMoverName, projectName, context) + .getValue(); + return this; + } + + public ProjectImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateProject.withDescription(description); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java new file mode 100644 index 0000000000000..f7cdaf49c42d7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java @@ -0,0 +1,1182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.ProjectsClient; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; +import com.azure.resourcemanager.storagemover.models.ProjectList; +import com.azure.resourcemanager.storagemover.models.ProjectUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProjectsClient. */ +public final class ProjectsClientImpl implements ProjectsClient { + /** The proxy service used to perform REST calls. */ + private final ProjectsService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of ProjectsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProjectsClientImpl(StorageMoverClientImpl client) { + this.service = RestProxy.create(ProjectsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientProjects to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientPr") + private interface ProjectsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ProjectInner project, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ProjectUpdateParameters project, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}/projects/{projectName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String storageMoverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String storageMoverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageMoverName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageMoverName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageMoverName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageMoverName) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName)); + } + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageMoverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, storageMoverName, context)); + } + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String storageMoverName, String projectName) { + return getWithResponseAsync(resourceGroupName, storageMoverName, projectName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner get(String resourceGroupName, String storageMoverName, String projectName) { + return getAsync(resourceGroupName, storageMoverName, projectName).block(); + } + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + return getWithResponseAsync(resourceGroupName, storageMoverName, projectName, context).block(); + } + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (project == null) { + return Mono.error(new IllegalArgumentException("Parameter project is required and cannot be null.")); + } else { + project.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + project, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (project == null) { + return Mono.error(new IllegalArgumentException("Parameter project is required and cannot be null.")); + } else { + project.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + project, + accept, + context); + } + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, projectName, project) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner createOrUpdate( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project) { + return createOrUpdateAsync(resourceGroupName, storageMoverName, projectName, project).block(); + } + + /** + * Creates or updates a project resource, which is a logical grouping of related jobs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String storageMoverName, String projectName, ProjectInner project, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, projectName, project, context) + .block(); + } + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, ProjectUpdateParameters project) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (project == null) { + return Mono.error(new IllegalArgumentException("Parameter project is required and cannot be null.")); + } else { + project.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + project, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String storageMoverName, + String projectName, + ProjectUpdateParameters project, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (project == null) { + return Mono.error(new IllegalArgumentException("Parameter project is required and cannot be null.")); + } else { + project.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + project, + accept, + context); + } + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String storageMoverName, String projectName, ProjectUpdateParameters project) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, projectName, project) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner update( + String resourceGroupName, String storageMoverName, String projectName, ProjectUpdateParameters project) { + return updateAsync(resourceGroupName, storageMoverName, projectName, project).block(); + } + + /** + * Updates properties for a project resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param project The project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + ProjectUpdateParameters project, + Context context) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, projectName, project, context).block(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + projectName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String projectName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, projectName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, storageMoverName, projectName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String projectName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName).getSyncPoller(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName, context).getSyncPoller(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String storageMoverName, String projectName) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, projectName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, String projectName) { + deleteAsync(resourceGroupName, storageMoverName, projectName).block(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, String projectName, Context context) { + deleteAsync(resourceGroupName, storageMoverName, projectName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsImpl.java new file mode 100644 index 0000000000000..750364c299671 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.ProjectsClient; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; +import com.azure.resourcemanager.storagemover.models.Project; +import com.azure.resourcemanager.storagemover.models.Projects; + +public final class ProjectsImpl implements Projects { + private static final ClientLogger LOGGER = new ClientLogger(ProjectsImpl.class); + + private final ProjectsClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public ProjectsImpl( + ProjectsClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String storageMoverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageMoverName); + return Utils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String storageMoverName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageMoverName, context); + return Utils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public Project get(String resourceGroupName, String storageMoverName, String projectName) { + ProjectInner inner = this.serviceClient().get(resourceGroupName, storageMoverName, projectName); + if (inner != null) { + return new ProjectImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String storageMoverName, String projectName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, storageMoverName, projectName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProjectImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String storageMoverName, String projectName) { + this.serviceClient().delete(resourceGroupName, storageMoverName, projectName); + } + + public void delete(String resourceGroupName, String storageMoverName, String projectName, Context context) { + this.serviceClient().delete(resourceGroupName, storageMoverName, projectName, context); + } + + public Project getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, projectName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getWithResponse(resourceGroupName, storageMoverName, projectName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + this.delete(resourceGroupName, storageMoverName, projectName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + String projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + this.delete(resourceGroupName, storageMoverName, projectName, context); + } + + private ProjectsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + public ProjectImpl define(String name) { + return new ProjectImpl(name, this.manager()); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java new file mode 100644 index 0000000000000..39a13dd973fb8 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the StorageMoverClientImpl type. */ +@ServiceClientBuilder(serviceClients = {StorageMoverClientImpl.class}) +public final class StorageMoverClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the StorageMoverClientBuilder. + */ + public StorageMoverClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the StorageMoverClientBuilder. + */ + public StorageMoverClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the StorageMoverClientBuilder. + */ + public StorageMoverClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the StorageMoverClientBuilder. + */ + public StorageMoverClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the StorageMoverClientBuilder. + */ + public StorageMoverClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the StorageMoverClientBuilder. + */ + public StorageMoverClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of StorageMoverClientImpl with the provided parameters. + * + * @return an instance of StorageMoverClientImpl. + */ + public StorageMoverClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + StorageMoverClientImpl client = + new StorageMoverClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java new file mode 100644 index 0000000000000..7113213a1823e --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.storagemover.fluent.AgentsClient; +import com.azure.resourcemanager.storagemover.fluent.EndpointsClient; +import com.azure.resourcemanager.storagemover.fluent.JobDefinitionsClient; +import com.azure.resourcemanager.storagemover.fluent.JobRunsClient; +import com.azure.resourcemanager.storagemover.fluent.OperationsClient; +import com.azure.resourcemanager.storagemover.fluent.ProjectsClient; +import com.azure.resourcemanager.storagemover.fluent.StorageMoverClient; +import com.azure.resourcemanager.storagemover.fluent.StorageMoversClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the StorageMoverClientImpl type. */ +@ServiceClient(builder = StorageMoverClientBuilder.class) +public final class StorageMoverClientImpl implements StorageMoverClient { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The StorageMoversClient object to access its operations. */ + private final StorageMoversClient storageMovers; + + /** + * Gets the StorageMoversClient object to access its operations. + * + * @return the StorageMoversClient object. + */ + public StorageMoversClient getStorageMovers() { + return this.storageMovers; + } + + /** The AgentsClient object to access its operations. */ + private final AgentsClient agents; + + /** + * Gets the AgentsClient object to access its operations. + * + * @return the AgentsClient object. + */ + public AgentsClient getAgents() { + return this.agents; + } + + /** The EndpointsClient object to access its operations. */ + private final EndpointsClient endpoints; + + /** + * Gets the EndpointsClient object to access its operations. + * + * @return the EndpointsClient object. + */ + public EndpointsClient getEndpoints() { + return this.endpoints; + } + + /** The ProjectsClient object to access its operations. */ + private final ProjectsClient projects; + + /** + * Gets the ProjectsClient object to access its operations. + * + * @return the ProjectsClient object. + */ + public ProjectsClient getProjects() { + return this.projects; + } + + /** The JobDefinitionsClient object to access its operations. */ + private final JobDefinitionsClient jobDefinitions; + + /** + * Gets the JobDefinitionsClient object to access its operations. + * + * @return the JobDefinitionsClient object. + */ + public JobDefinitionsClient getJobDefinitions() { + return this.jobDefinitions; + } + + /** The JobRunsClient object to access its operations. */ + private final JobRunsClient jobRuns; + + /** + * Gets the JobRunsClient object to access its operations. + * + * @return the JobRunsClient object. + */ + public JobRunsClient getJobRuns() { + return this.jobRuns; + } + + /** + * Initializes an instance of StorageMoverClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + StorageMoverClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2022-07-01-preview"; + this.operations = new OperationsClientImpl(this); + this.storageMovers = new StorageMoversClientImpl(this); + this.agents = new AgentsClientImpl(this); + this.endpoints = new EndpointsClientImpl(this); + this.projects = new ProjectsClientImpl(this); + this.jobDefinitions = new JobDefinitionsClientImpl(this); + this.jobRuns = new JobRunsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageMoverClientImpl.class); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverImpl.java new file mode 100644 index 0000000000000..e40da6ad24648 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; +import com.azure.resourcemanager.storagemover.models.ProvisioningState; +import com.azure.resourcemanager.storagemover.models.StorageMover; +import com.azure.resourcemanager.storagemover.models.StorageMoverUpdateParameters; +import java.util.Collections; +import java.util.Map; + +public final class StorageMoverImpl implements StorageMover, StorageMover.Definition, StorageMover.Update { + private StorageMoverInner innerObject; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public StorageMoverInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageMoverName; + + private StorageMoverUpdateParameters updateStorageMover; + + public StorageMoverImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public StorageMover create() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageMovers() + .createOrUpdateWithResponse(resourceGroupName, storageMoverName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public StorageMover create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageMovers() + .createOrUpdateWithResponse(resourceGroupName, storageMoverName, this.innerModel(), context) + .getValue(); + return this; + } + + StorageMoverImpl(String name, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = new StorageMoverInner(); + this.serviceManager = serviceManager; + this.storageMoverName = name; + } + + public StorageMoverImpl update() { + this.updateStorageMover = new StorageMoverUpdateParameters(); + return this; + } + + public StorageMover apply() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageMovers() + .updateWithResponse(resourceGroupName, storageMoverName, updateStorageMover, Context.NONE) + .getValue(); + return this; + } + + public StorageMover apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageMovers() + .updateWithResponse(resourceGroupName, storageMoverName, updateStorageMover, context) + .getValue(); + return this; + } + + StorageMoverImpl( + StorageMoverInner innerObject, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageMoverName = Utils.getValueFromIdByName(innerObject.id(), "storageMovers"); + } + + public StorageMover refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageMovers() + .getByResourceGroupWithResponse(resourceGroupName, storageMoverName, Context.NONE) + .getValue(); + return this; + } + + public StorageMover refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageMovers() + .getByResourceGroupWithResponse(resourceGroupName, storageMoverName, context) + .getValue(); + return this; + } + + public StorageMoverImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StorageMoverImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StorageMoverImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateStorageMover.withTags(tags); + return this; + } + } + + public StorageMoverImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateStorageMover.withDescription(description); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java new file mode 100644 index 0000000000000..e65e268b01c63 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java @@ -0,0 +1,1338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagemover.fluent.StorageMoversClient; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; +import com.azure.resourcemanager.storagemover.models.StorageMoverList; +import com.azure.resourcemanager.storagemover.models.StorageMoverUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in StorageMoversClient. */ +public final class StorageMoversClientImpl implements StorageMoversClient { + /** The proxy service used to perform REST calls. */ + private final StorageMoversService service; + + /** The service client containing this operation class. */ + private final StorageMoverClientImpl client; + + /** + * Initializes an instance of StorageMoversClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageMoversClientImpl(StorageMoverClientImpl client) { + this.service = + RestProxy.create(StorageMoversService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageMoverClientStorageMovers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageMoverClientSt") + private interface StorageMoversService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StorageMoverInner storageMover, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StorageMoverUpdateParameters storageMover, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover" + + "/storageMovers/{storageMoverName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageMoverName") String storageMoverName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all Storage Movers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Storage Movers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all Storage Movers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Storage Movers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all Storage Movers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all Storage Movers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String storageMoverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String storageMoverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String storageMoverName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, storageMoverName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageMoverInner getByResourceGroup(String resourceGroupName, String storageMoverName) { + return getByResourceGroupAsync(resourceGroupName, storageMoverName).block(); + } + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String storageMoverName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, storageMoverName, context).block(); + } + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, StorageMoverInner storageMover) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (storageMover == null) { + return Mono.error(new IllegalArgumentException("Parameter storageMover is required and cannot be null.")); + } else { + storageMover.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + storageMover, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String storageMoverName, StorageMoverInner storageMover, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (storageMover == null) { + return Mono.error(new IllegalArgumentException("Parameter storageMover is required and cannot be null.")); + } else { + storageMover.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + storageMover, + accept, + context); + } + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String storageMoverName, StorageMoverInner storageMover) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, storageMover) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageMoverInner createOrUpdate( + String resourceGroupName, String storageMoverName, StorageMoverInner storageMover) { + return createOrUpdateAsync(resourceGroupName, storageMoverName, storageMover).block(); + } + + /** + * Creates or updates a top-level Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Storage Mover agents and + * projects. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String storageMoverName, StorageMoverInner storageMover, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, storageMoverName, storageMover, context).block(); + } + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (storageMover == null) { + return Mono.error(new IllegalArgumentException("Parameter storageMover is required and cannot be null.")); + } else { + storageMover.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + storageMover, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + if (storageMover == null) { + return Mono.error(new IllegalArgumentException("Parameter storageMover is required and cannot be null.")); + } else { + storageMover.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + storageMover, + accept, + context); + } + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, storageMover) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageMoverInner update( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover) { + return updateAsync(resourceGroupName, storageMoverName, storageMover).block(); + } + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Storage Mover resource, which is a container for a group of Storage Mover agents and projects along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String storageMoverName, StorageMoverUpdateParameters storageMover, Context context) { + return updateWithResponseAsync(resourceGroupName, storageMoverName, storageMover, context).block(); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String storageMoverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageMoverName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageMoverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + storageMoverName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String storageMoverName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageMoverName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String storageMoverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageMoverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String storageMoverName) { + return beginDeleteAsync(resourceGroupName, storageMoverName).getSyncPoller(); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String storageMoverName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, context).getSyncPoller(); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String storageMoverName) { + return beginDeleteAsync(resourceGroupName, storageMoverName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String storageMoverName, Context context) { + return beginDeleteAsync(resourceGroupName, storageMoverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName) { + deleteAsync(resourceGroupName, storageMoverName).block(); + } + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageMoverName, Context context) { + deleteAsync(resourceGroupName, storageMoverName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversImpl.java new file mode 100644 index 0000000000000..5b15d199810a6 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagemover.fluent.StorageMoversClient; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; +import com.azure.resourcemanager.storagemover.models.StorageMover; +import com.azure.resourcemanager.storagemover.models.StorageMovers; + +public final class StorageMoversImpl implements StorageMovers { + private static final ClientLogger LOGGER = new ClientLogger(StorageMoversImpl.class); + + private final StorageMoversClient innerClient; + + private final com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager; + + public StorageMoversImpl( + StorageMoversClient innerClient, com.azure.resourcemanager.storagemover.StorageMoverManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new StorageMoverImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new StorageMoverImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new StorageMoverImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new StorageMoverImpl(inner1, this.manager())); + } + + public StorageMover getByResourceGroup(String resourceGroupName, String storageMoverName) { + StorageMoverInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, storageMoverName); + if (inner != null) { + return new StorageMoverImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String storageMoverName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, storageMoverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new StorageMoverImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String storageMoverName) { + this.serviceClient().delete(resourceGroupName, storageMoverName); + } + + public void delete(String resourceGroupName, String storageMoverName, Context context) { + this.serviceClient().delete(resourceGroupName, storageMoverName, context); + } + + public StorageMover getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageMoverName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageMoverName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + this.delete(resourceGroupName, storageMoverName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageMoverName = Utils.getValueFromIdByName(id, "storageMovers"); + if (storageMoverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageMovers'.", id))); + } + this.delete(resourceGroupName, storageMoverName, context); + } + + private StorageMoversClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagemover.StorageMoverManager manager() { + return this.serviceManager; + } + + public StorageMoverImpl define(String name) { + return new StorageMoverImpl(name, this.manager()); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/Utils.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/Utils.java new file mode 100644 index 0000000000000..4f8bd70099a5a --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java new file mode 100644 index 0000000000000..1508747abdbc3 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for StorageMoverClient. The Azure Storage Mover REST API. */ +package com.azure.resourcemanager.storagemover.implementation; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java new file mode 100644 index 0000000000000..b8cbf8a3d69d8 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionType. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agent.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agent.java new file mode 100644 index 0000000000000..f0eeb7d758517 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agent.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Agent. */ +public interface Agent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: A description for the agent. + * + * @return the description value. + */ + String description(); + + /** + * Gets the agentVersion property: The agent version. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the arcResourceId property: The fully qualified resource ID of the hybrid compute resource for the agent. + * + * @return the arcResourceId value. + */ + String arcResourceId(); + + /** + * Gets the arcVmUuid property: A GUID for this agent. + * + * @return the arcVmUuid value. + */ + String arcVmUuid(); + + /** + * Gets the agentStatus property: The agent status. + * + * @return the agentStatus value. + */ + AgentStatus agentStatus(); + + /** + * Gets the lastStatusUpdate property: The last updated time of the agent status. + * + * @return the lastStatusUpdate value. + */ + OffsetDateTime lastStatusUpdate(); + + /** + * Gets the localIpAddress property: Local IP address reported by the agent. + * + * @return the localIpAddress value. + */ + String localIpAddress(); + + /** + * Gets the memoryInMB property: Available memory reported by the agent, in MB. + * + * @return the memoryInMB value. + */ + Long memoryInMB(); + + /** + * Gets the numberOfCores property: Available compute cores reported by the agent. + * + * @return the numberOfCores value. + */ + Long numberOfCores(); + + /** + * Gets the errorDetails property: The errorDetails property. + * + * @return the errorDetails value. + */ + AgentPropertiesErrorDetails errorDetails(); + + /** + * Gets the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.AgentInner object. + * + * @return the inner object. + */ + AgentInner innerModel(); + + /** The entirety of the Agent definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Agent definition stages. */ + interface DefinitionStages { + /** The first stage of the Agent definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Agent definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, storageMoverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @return the next definition stage. + */ + WithCreate withExistingStorageMover(String resourceGroupName, String storageMoverName); + } + /** + * The stage of the Agent definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithDescription, + DefinitionStages.WithArcResourceId, + DefinitionStages.WithArcVmUuid { + /** + * Executes the create request. + * + * @return the created resource. + */ + Agent create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Agent create(Context context); + } + /** The stage of the Agent definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the agent.. + * + * @param description A description for the agent. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Agent definition allowing to specify arcResourceId. */ + interface WithArcResourceId { + /** + * Specifies the arcResourceId property: The fully qualified resource ID of the hybrid compute resource for + * the agent.. + * + * @param arcResourceId The fully qualified resource ID of the hybrid compute resource for the agent. + * @return the next definition stage. + */ + WithCreate withArcResourceId(String arcResourceId); + } + /** The stage of the Agent definition allowing to specify arcVmUuid. */ + interface WithArcVmUuid { + /** + * Specifies the arcVmUuid property: A GUID for this agent.. + * + * @param arcVmUuid A GUID for this agent. + * @return the next definition stage. + */ + WithCreate withArcVmUuid(String arcVmUuid); + } + } + /** + * Begins update for the Agent resource. + * + * @return the stage of resource update. + */ + Agent.Update update(); + + /** The template for Agent update. */ + interface Update extends UpdateStages.WithDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Agent apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Agent apply(Context context); + } + /** The Agent update stages. */ + interface UpdateStages { + /** The stage of the Agent update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the agent.. + * + * @param description A description for the agent. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Agent refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Agent refresh(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java new file mode 100644 index 0000000000000..45fdcb63b4e73 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of agents. */ +@Immutable +public final class AgentList { + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of containers. Returned + * when total number of requested containers exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of containers. Returned when total + * number of requested containers exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java new file mode 100644 index 0000000000000..f0a6dc3dc57c3 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AgentPropertiesErrorDetails model. */ +@Fluent +public final class AgentPropertiesErrorDetails { + /* + * Error code reported by Agent + */ + @JsonProperty(value = "code") + private String code; + + /* + * Expanded description of reported error code + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: Error code reported by Agent. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Error code reported by Agent. + * + * @param code the code value to set. + * @return the AgentPropertiesErrorDetails object itself. + */ + public AgentPropertiesErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: Expanded description of reported error code. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Expanded description of reported error code. + * + * @param message the message value to set. + * @return the AgentPropertiesErrorDetails object itself. + */ + public AgentPropertiesErrorDetails withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java new file mode 100644 index 0000000000000..eb7ed97460dd6 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AgentStatus. */ +public final class AgentStatus extends ExpandableStringEnum { + /** Static value Provisioning for AgentStatus. */ + public static final AgentStatus PROVISIONING = fromString("Provisioning"); + + /** Static value Offline for AgentStatus. */ + public static final AgentStatus OFFLINE = fromString("Offline"); + + /** Static value Online for AgentStatus. */ + public static final AgentStatus ONLINE = fromString("Online"); + + /** Static value Executing for AgentStatus. */ + public static final AgentStatus EXECUTING = fromString("Executing"); + + /** Static value RequiresAttention for AgentStatus. */ + public static final AgentStatus REQUIRES_ATTENTION = fromString("RequiresAttention"); + + /** Static value Deprovisioning for AgentStatus. */ + public static final AgentStatus DEPROVISIONING = fromString("Deprovisioning"); + + /** + * Creates or finds a AgentStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentStatus. + */ + @JsonCreator + public static AgentStatus fromString(String name) { + return fromString(name, AgentStatus.class); + } + + /** + * Gets known AgentStatus values. + * + * @return known AgentStatus values. + */ + public static Collection values() { + return values(AgentStatus.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java new file mode 100644 index 0000000000000..3c84e96cdab96 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.fluent.models.AgentUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The agent resource. */ +@Fluent +public final class AgentUpdateParameters { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private AgentUpdateProperties innerProperties; + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private AgentUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: A description for the agent. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the agent. + * + * @param description the description value to set. + * @return the AgentUpdateParameters object itself. + */ + public AgentUpdateParameters withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agents.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agents.java new file mode 100644 index 0000000000000..c48884bd45557 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Agents.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Agents. */ +public interface Agents { + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName); + + /** + * Lists all agents in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource. + */ + Agent get(String resourceGroupName, String storageMoverName, String agentName); + + /** + * Gets an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String storageMoverName, String agentName, Context context); + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String agentName); + + /** + * Deletes an agent resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the agent resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String agentName, Context context); + + /** + * Gets an agent resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response}. + */ + Agent getById(String id); + + /** + * Gets an agent resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agent resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an agent resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an agent resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Agent resource. + * + * @param name resource name. + * @return the first stage of the new Agent definition. + */ + Agent.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java new file mode 100644 index 0000000000000..c6746c3a59d85 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The AzureStorageBlobContainerEndpointProperties model. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "endpointType") +@JsonTypeName("AzureStorageBlobContainer") +@Fluent +public final class AzureStorageBlobContainerEndpointProperties extends EndpointBaseProperties { + /* + * The Azure Resource ID of the storage account that is the target + * destination. + */ + @JsonProperty(value = "storageAccountResourceId", required = true) + private String storageAccountResourceId; + + /* + * The name of the Storage blob container that is the target destination. + */ + @JsonProperty(value = "blobContainerName", required = true) + private String blobContainerName; + + /** + * Get the storageAccountResourceId property: The Azure Resource ID of the storage account that is the target + * destination. + * + * @return the storageAccountResourceId value. + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set the storageAccountResourceId property: The Azure Resource ID of the storage account that is the target + * destination. + * + * @param storageAccountResourceId the storageAccountResourceId value to set. + * @return the AzureStorageBlobContainerEndpointProperties object itself. + */ + public AzureStorageBlobContainerEndpointProperties withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get the blobContainerName property: The name of the Storage blob container that is the target destination. + * + * @return the blobContainerName value. + */ + public String blobContainerName() { + return this.blobContainerName; + } + + /** + * Set the blobContainerName property: The name of the Storage blob container that is the target destination. + * + * @param blobContainerName the blobContainerName value to set. + * @return the AzureStorageBlobContainerEndpointProperties object itself. + */ + public AzureStorageBlobContainerEndpointProperties withBlobContainerName(String blobContainerName) { + this.blobContainerName = blobContainerName; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureStorageBlobContainerEndpointProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (storageAccountResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageAccountResourceId in model" + + " AzureStorageBlobContainerEndpointProperties")); + } + if (blobContainerName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property blobContainerName in model" + + " AzureStorageBlobContainerEndpointProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureStorageBlobContainerEndpointProperties.class); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java new file mode 100644 index 0000000000000..f90e73f8d6361 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; + +/** The AzureStorageBlobContainerEndpointUpdateProperties model. */ +@Fluent +public final class AzureStorageBlobContainerEndpointUpdateProperties extends EndpointBaseUpdateProperties { + /** {@inheritDoc} */ + @Override + public AzureStorageBlobContainerEndpointUpdateProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java new file mode 100644 index 0000000000000..d508e88690c57 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CopyMode. */ +public final class CopyMode extends ExpandableStringEnum { + /** Static value Additive for CopyMode. */ + public static final CopyMode ADDITIVE = fromString("Additive"); + + /** Static value Mirror for CopyMode. */ + public static final CopyMode MIRROR = fromString("Mirror"); + + /** + * Creates or finds a CopyMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CopyMode. + */ + @JsonCreator + public static CopyMode fromString(String name) { + return fromString(name, CopyMode.class); + } + + /** + * Gets known CopyMode values. + * + * @return known CopyMode values. + */ + public static Collection values() { + return values(CopyMode.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoint.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoint.java new file mode 100644 index 0000000000000..07edf3b0a2ab4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoint.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; + +/** An immutable client-side representation of Endpoint. */ +public interface Endpoint { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource specific properties for the Storage Mover resource. + * + * @return the properties value. + */ + EndpointBaseProperties properties(); + + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.EndpointInner object. + * + * @return the inner object. + */ + EndpointInner innerModel(); + + /** The entirety of the Endpoint definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Endpoint definition stages. */ + interface DefinitionStages { + /** The first stage of the Endpoint definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Endpoint definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, storageMoverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @return the next definition stage. + */ + WithCreate withExistingStorageMover(String resourceGroupName, String storageMoverName); + } + /** + * The stage of the Endpoint definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Endpoint create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Endpoint create(Context context); + } + /** The stage of the Endpoint definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The resource specific properties for the Storage Mover resource.. + * + * @param properties The resource specific properties for the Storage Mover resource. + * @return the next definition stage. + */ + WithCreate withProperties(EndpointBaseProperties properties); + } + } + /** + * Begins update for the Endpoint resource. + * + * @return the stage of resource update. + */ + Endpoint.Update update(); + + /** The template for Endpoint update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Endpoint apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Endpoint apply(Context context); + } + /** The Endpoint update stages. */ + interface UpdateStages { + /** The stage of the Endpoint update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The endpoint resource, which contains information about file sources + * and targets.. + * + * @param properties The endpoint resource, which contains information about file sources and targets. + * @return the next definition stage. + */ + Update withProperties(EndpointBaseUpdateProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Endpoint refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Endpoint refresh(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java new file mode 100644 index 0000000000000..b1f3be490668d --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The resource specific properties for the Storage Mover resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "endpointType", + defaultImpl = EndpointBaseProperties.class) +@JsonTypeName("EndpointBaseProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AzureStorageBlobContainer", value = AzureStorageBlobContainerEndpointProperties.class), + @JsonSubTypes.Type(name = "NfsMount", value = NfsMountEndpointProperties.class) +}) +@Fluent +public class EndpointBaseProperties { + /* + * A description for the endpoint. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The provisioning state of this resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the description property: A description for the endpoint. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the endpoint. + * + * @param description the description value to set. + * @return the EndpointBaseProperties object itself. + */ + public EndpointBaseProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java new file mode 100644 index 0000000000000..2f01f658f6a82 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The endpoint resource. */ +@Fluent +public final class EndpointBaseUpdateParameters { + /* + * The endpoint resource, which contains information about file sources and + * targets. + */ + @JsonProperty(value = "properties") + private EndpointBaseUpdateProperties properties; + + /** + * Get the properties property: The endpoint resource, which contains information about file sources and targets. + * + * @return the properties value. + */ + public EndpointBaseUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The endpoint resource, which contains information about file sources and targets. + * + * @param properties the properties value to set. + * @return the EndpointBaseUpdateParameters object itself. + */ + public EndpointBaseUpdateParameters withProperties(EndpointBaseUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java new file mode 100644 index 0000000000000..8acd41d935134 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The endpoint resource, which contains information about file sources and targets. */ +@Fluent +public class EndpointBaseUpdateProperties { + /* + * A description for the endpoint. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the description property: A description for the endpoint. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for the endpoint. + * + * @param description the description value to set. + * @return the EndpointBaseUpdateProperties object itself. + */ + public EndpointBaseUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java new file mode 100644 index 0000000000000..a196d8c771a25 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of endpoints. */ +@Immutable +public final class EndpointList { + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of containers. Returned + * when total number of requested containers exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of containers. Returned when total + * number of requested containers exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java new file mode 100644 index 0000000000000..c4908cb7c03c1 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EndpointType. */ +public final class EndpointType extends ExpandableStringEnum { + /** Static value AzureStorageBlobContainer for EndpointType. */ + public static final EndpointType AZURE_STORAGE_BLOB_CONTAINER = fromString("AzureStorageBlobContainer"); + + /** Static value NfsMount for EndpointType. */ + public static final EndpointType NFS_MOUNT = fromString("NfsMount"); + + /** + * Creates or finds a EndpointType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EndpointType. + */ + @JsonCreator + public static EndpointType fromString(String name) { + return fromString(name, EndpointType.class); + } + + /** + * Gets known EndpointType values. + * + * @return known EndpointType values. + */ + public static Collection values() { + return values(EndpointType.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoints.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoints.java new file mode 100644 index 0000000000000..9079fd7916fc7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Endpoints.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Endpoints. */ +public interface Endpoints { + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName); + + /** + * Lists all endpoints in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of endpoints as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource. + */ + Endpoint get(String resourceGroupName, String storageMoverName, String endpointName); + + /** + * Gets an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String storageMoverName, String endpointName, Context context); + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String endpointName); + + /** + * Deletes an endpoint resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the endpoint resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String endpointName, Context context); + + /** + * Gets an endpoint resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response}. + */ + Endpoint getById(String id); + + /** + * Gets an endpoint resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an endpoint resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an endpoint resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an endpoint resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Endpoint resource. + * + * @param name resource name. + * @return the first stage of the new Endpoint definition. + */ + Endpoint.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinition.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinition.java new file mode 100644 index 0000000000000..b6420d1aa47a9 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinition.java @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; + +/** An immutable client-side representation of JobDefinition. */ +public interface JobDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: A description for the job definition. + * + * @return the description value. + */ + String description(); + + /** + * Gets the copyMode property: Strategy to use for copy. + * + * @return the copyMode value. + */ + CopyMode copyMode(); + + /** + * Gets the sourceName property: The name of the source endpoint. + * + * @return the sourceName value. + */ + String sourceName(); + + /** + * Gets the sourceResourceId property: Fully qualified resource ID of the source endpoint. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * Gets the sourceSubpath property: The subpath to use when reading from the source Endpoint. + * + * @return the sourceSubpath value. + */ + String sourceSubpath(); + + /** + * Gets the targetName property: The name of the target endpoint. + * + * @return the targetName value. + */ + String targetName(); + + /** + * Gets the targetResourceId property: Fully qualified resource ID of the target endpoint. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the targetSubpath property: The subpath to use when writing to the target Endpoint. + * + * @return the targetSubpath value. + */ + String targetSubpath(); + + /** + * Gets the latestJobRunName property: The name of the job run in a non-terminal state, if exists. + * + * @return the latestJobRunName value. + */ + String latestJobRunName(); + + /** + * Gets the latestJobRunResourceId property: The fully qualified resource ID of the job run in a non-terminal state, + * if exists. + * + * @return the latestJobRunResourceId value. + */ + String latestJobRunResourceId(); + + /** + * Gets the latestJobRunStatus property: The current status of the job run in a non-terminal state, if exists. + * + * @return the latestJobRunStatus value. + */ + JobRunStatus latestJobRunStatus(); + + /** + * Gets the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @return the agentName value. + */ + String agentName(); + + /** + * Gets the agentResourceId property: Fully qualified resource id of the agent to assign for new job runs of this + * definition. + * + * @return the agentResourceId value. + */ + String agentResourceId(); + + /** + * Gets the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner object. + * + * @return the inner object. + */ + JobDefinitionInner innerModel(); + + /** The entirety of the JobDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the JobDefinition definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobDefinition definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, storageMoverName, projectName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @return the next definition stage. + */ + WithCreate withExistingProject(String resourceGroupName, String storageMoverName, String projectName); + } + /** + * The stage of the JobDefinition definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithDescription, + DefinitionStages.WithCopyMode, + DefinitionStages.WithSourceName, + DefinitionStages.WithSourceSubpath, + DefinitionStages.WithTargetName, + DefinitionStages.WithTargetSubpath, + DefinitionStages.WithAgentName { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobDefinition create(Context context); + } + /** The stage of the JobDefinition definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the job definition.. + * + * @param description A description for the job definition. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the JobDefinition definition allowing to specify copyMode. */ + interface WithCopyMode { + /** + * Specifies the copyMode property: Strategy to use for copy.. + * + * @param copyMode Strategy to use for copy. + * @return the next definition stage. + */ + WithCreate withCopyMode(CopyMode copyMode); + } + /** The stage of the JobDefinition definition allowing to specify sourceName. */ + interface WithSourceName { + /** + * Specifies the sourceName property: The name of the source endpoint.. + * + * @param sourceName The name of the source endpoint. + * @return the next definition stage. + */ + WithCreate withSourceName(String sourceName); + } + /** The stage of the JobDefinition definition allowing to specify sourceSubpath. */ + interface WithSourceSubpath { + /** + * Specifies the sourceSubpath property: The subpath to use when reading from the source Endpoint.. + * + * @param sourceSubpath The subpath to use when reading from the source Endpoint. + * @return the next definition stage. + */ + WithCreate withSourceSubpath(String sourceSubpath); + } + /** The stage of the JobDefinition definition allowing to specify targetName. */ + interface WithTargetName { + /** + * Specifies the targetName property: The name of the target endpoint.. + * + * @param targetName The name of the target endpoint. + * @return the next definition stage. + */ + WithCreate withTargetName(String targetName); + } + /** The stage of the JobDefinition definition allowing to specify targetSubpath. */ + interface WithTargetSubpath { + /** + * Specifies the targetSubpath property: The subpath to use when writing to the target Endpoint.. + * + * @param targetSubpath The subpath to use when writing to the target Endpoint. + * @return the next definition stage. + */ + WithCreate withTargetSubpath(String targetSubpath); + } + /** The stage of the JobDefinition definition allowing to specify agentName. */ + interface WithAgentName { + /** + * Specifies the agentName property: Name of the agent to assign for new job runs of this definition.. + * + * @param agentName Name of the agent to assign for new job runs of this definition. + * @return the next definition stage. + */ + WithCreate withAgentName(String agentName); + } + } + /** + * Begins update for the JobDefinition resource. + * + * @return the stage of resource update. + */ + JobDefinition.Update update(); + + /** The template for JobDefinition update. */ + interface Update extends UpdateStages.WithDescription, UpdateStages.WithCopyMode, UpdateStages.WithAgentName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobDefinition apply(Context context); + } + /** The JobDefinition update stages. */ + interface UpdateStages { + /** The stage of the JobDefinition update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the job definition.. + * + * @param description A description for the job definition. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the JobDefinition update allowing to specify copyMode. */ + interface WithCopyMode { + /** + * Specifies the copyMode property: Strategy to use for copy.. + * + * @param copyMode Strategy to use for copy. + * @return the next definition stage. + */ + Update withCopyMode(CopyMode copyMode); + } + /** The stage of the JobDefinition update allowing to specify agentName. */ + interface WithAgentName { + /** + * Specifies the agentName property: Name of the agent to assign for new job runs of this definition.. + * + * @param agentName Name of the agent to assign for new job runs of this definition. + * @return the next definition stage. + */ + Update withAgentName(String agentName); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobDefinition refresh(Context context); + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + JobRunResourceId startJob(); + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + Response startJobWithResponse(Context context); + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + JobRunResourceId stopJob(); + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + Response stopJobWithResponse(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java new file mode 100644 index 0000000000000..f2113e0f90ab7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of job definitions. */ +@Immutable +public final class JobDefinitionList { + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of containers. Returned + * when total number of requested containers exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of containers. Returned when total + * number of requested containers exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java new file mode 100644 index 0000000000000..73d3462686e99 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The job definition resource. */ +@Fluent +public final class JobDefinitionUpdateParameters { + /* + * Job definition properties. + */ + @JsonProperty(value = "properties") + private JobDefinitionUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Job definition properties. + * + * @return the innerProperties value. + */ + private JobDefinitionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: A description for the job definition. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the job definition. + * + * @param description the description value to set. + * @return the JobDefinitionUpdateParameters object itself. + */ + public JobDefinitionUpdateParameters withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the copyMode property: Strategy to use for copy. + * + * @return the copyMode value. + */ + public CopyMode copyMode() { + return this.innerProperties() == null ? null : this.innerProperties().copyMode(); + } + + /** + * Set the copyMode property: Strategy to use for copy. + * + * @param copyMode the copyMode value to set. + * @return the JobDefinitionUpdateParameters object itself. + */ + public JobDefinitionUpdateParameters withCopyMode(CopyMode copyMode) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionUpdateProperties(); + } + this.innerProperties().withCopyMode(copyMode); + return this; + } + + /** + * Get the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @return the agentName value. + */ + public String agentName() { + return this.innerProperties() == null ? null : this.innerProperties().agentName(); + } + + /** + * Set the agentName property: Name of the agent to assign for new job runs of this definition. + * + * @param agentName the agentName value to set. + * @return the JobDefinitionUpdateParameters object itself. + */ + public JobDefinitionUpdateParameters withAgentName(String agentName) { + if (this.innerProperties() == null) { + this.innerProperties = new JobDefinitionUpdateProperties(); + } + this.innerProperties().withAgentName(agentName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitions.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitions.java new file mode 100644 index 0000000000000..715af40abdc51 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitions.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobDefinitions. */ +public interface JobDefinitions { + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName, String projectName); + + /** + * Lists all job definitions in a project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, Context context); + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource. + */ + JobDefinition get(String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Gets a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Deletes a job definition resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + JobRunResourceId startJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Requests an agent to start a new instance of this job definition, generating a new job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + Response startJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun. + */ + JobRunResourceId stopJob( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Requests the agent of any active instance of this job definition to stop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response that identifies a JobRun along with {@link Response}. + */ + Response stopJobWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Gets a job definition resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response}. + */ + JobDefinition getById(String id); + + /** + * Gets a job definition resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job definition resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job definition resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a job definition resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobDefinition resource. + * + * @param name resource name. + * @return the first stage of the new JobDefinition definition. + */ + JobDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRun.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRun.java new file mode 100644 index 0000000000000..fa0d9722acd01 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRun.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of JobRun. */ +public interface JobRun { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the status property: The state of the job execution. + * + * @return the status value. + */ + JobRunStatus status(); + + /** + * Gets the scanStatus property: The status of agent's scanning of source. + * + * @return the scanStatus value. + */ + JobRunScanStatus scanStatus(); + + /** + * Gets the agentName property: Name of the agent assigned to this run. + * + * @return the agentName value. + */ + String agentName(); + + /** + * Gets the agentResourceId property: Fully qualified resource id of the agent assigned to this run. + * + * @return the agentResourceId value. + */ + String agentResourceId(); + + /** + * Gets the executionStartTime property: Start time of the run. Null if no agent reported that the job has started. + * + * @return the executionStartTime value. + */ + OffsetDateTime executionStartTime(); + + /** + * Gets the executionEndTime property: End time of the run. Null if agent has not reported that the job has ended. + * + * @return the executionEndTime value. + */ + OffsetDateTime executionEndTime(); + + /** + * Gets the lastUpdatedTime property: Last update time. + * + * @return the lastUpdatedTime value. + */ + OffsetDateTime lastUpdatedTime(); + + /** + * Gets the itemsScanned property: Number of items scanned so far in source. + * + * @return the itemsScanned value. + */ + Long itemsScanned(); + + /** + * Gets the itemsExcluded property: Number of items that will not be transferred, as they are excluded by user + * configuration. + * + * @return the itemsExcluded value. + */ + Long itemsExcluded(); + + /** + * Gets the itemsUnsupported property: Number of items that will not be transferred, as they are unsupported on + * target. + * + * @return the itemsUnsupported value. + */ + Long itemsUnsupported(); + + /** + * Gets the itemsNoTransferNeeded property: Number of items that will not be transferred, as they are already found + * on target (e.g. mirror mode). + * + * @return the itemsNoTransferNeeded value. + */ + Long itemsNoTransferNeeded(); + + /** + * Gets the itemsDesignatedForTransfer property: Number of items identified for transferring so far in scan. + * + * @return the itemsDesignatedForTransfer value. + */ + Long itemsDesignatedForTransfer(); + + /** + * Gets the itemsFailed property: Number of items that were attempted to transfer and failed. + * + * @return the itemsFailed value. + */ + Long itemsFailed(); + + /** + * Gets the itemsTransferred property: Number of items successfully transferred to target. + * + * @return the itemsTransferred value. + */ + Long itemsTransferred(); + + /** + * Gets the bytesScanned property: Bytes of data scanned so far in source. + * + * @return the bytesScanned value. + */ + Long bytesScanned(); + + /** + * Gets the bytesExcluded property: Bytes of data that will not be transferred, as they are excluded by user + * configuration. + * + * @return the bytesExcluded value. + */ + Long bytesExcluded(); + + /** + * Gets the bytesUnsupported property: Bytes of data that will not be transferred, as they are unsupported on + * target. + * + * @return the bytesUnsupported value. + */ + Long bytesUnsupported(); + + /** + * Gets the bytesNoTransferNeeded property: Bytes of data that will not be transferred, as they are already found on + * target (e.g. mirror mode). + * + * @return the bytesNoTransferNeeded value. + */ + Long bytesNoTransferNeeded(); + + /** + * Gets the bytesDesignatedForTransfer property: Bytes of data identified for transferring so far in scan. + * + * @return the bytesDesignatedForTransfer value. + */ + Long bytesDesignatedForTransfer(); + + /** + * Gets the bytesFailed property: Bytes of data that were attempted to transfer and failed. + * + * @return the bytesFailed value. + */ + Long bytesFailed(); + + /** + * Gets the bytesTransferred property: Bytes of data successfully transferred to target. + * + * @return the bytesTransferred value. + */ + Long bytesTransferred(); + + /** + * Gets the sourceName property: Name of source Endpoint resource. This resource may no longer exist. + * + * @return the sourceName value. + */ + String sourceName(); + + /** + * Gets the sourceResourceId property: Fully qualified resource id of source Endpoint. This id may no longer exist. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * Gets the sourceProperties property: Copy of source Endpoint resource's properties at time of Job Run creation. + * + * @return the sourceProperties value. + */ + Object sourceProperties(); + + /** + * Gets the targetName property: Name of target Endpoint resource. This resource may no longer exist. + * + * @return the targetName value. + */ + String targetName(); + + /** + * Gets the targetResourceId property: Fully qualified resource id of of Endpoint. This id may no longer exist. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the targetProperties property: Copy of Endpoint resource's properties at time of Job Run creation. + * + * @return the targetProperties value. + */ + Object targetProperties(); + + /** + * Gets the jobDefinitionProperties property: Copy of parent Job Definition's properties at time of Job Run + * creation. + * + * @return the jobDefinitionProperties value. + */ + Object jobDefinitionProperties(); + + /** + * Gets the error property: Error details. + * + * @return the error value. + */ + JobRunError error(); + + /** + * Gets the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.JobRunInner object. + * + * @return the inner object. + */ + JobRunInner innerModel(); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java new file mode 100644 index 0000000000000..8ed5d03b7878d --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error type. */ +@Fluent +public final class JobRunError { + /* + * Error code of the given entry. + */ + @JsonProperty(value = "code") + private String code; + + /* + * Error message of the given entry. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Target of the given error entry. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Get the code property: Error code of the given entry. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Error code of the given entry. + * + * @param code the code value to set. + * @return the JobRunError object itself. + */ + public JobRunError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: Error message of the given entry. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Error message of the given entry. + * + * @param message the message value to set. + * @return the JobRunError object itself. + */ + public JobRunError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target property: Target of the given error entry. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: Target of the given error entry. + * + * @param target the target value to set. + * @return the JobRunError object itself. + */ + public JobRunError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java new file mode 100644 index 0000000000000..735add7560234 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of job runs. */ +@Immutable +public final class JobRunList { + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of containers. Returned + * when total number of requested containers exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of containers. Returned when total + * number of requested containers exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunResourceId.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunResourceId.java new file mode 100644 index 0000000000000..947e7d95b7514 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunResourceId.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.resourcemanager.storagemover.fluent.models.JobRunResourceIdInner; + +/** An immutable client-side representation of JobRunResourceId. */ +public interface JobRunResourceId { + /** + * Gets the jobRunResourceId property: Fully qualified resource id of the JobRun. + * + * @return the jobRunResourceId value. + */ + String jobRunResourceId(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.JobRunResourceIdInner object. + * + * @return the inner object. + */ + JobRunResourceIdInner innerModel(); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java new file mode 100644 index 0000000000000..c98e975144b04 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobRunScanStatus. */ +public final class JobRunScanStatus extends ExpandableStringEnum { + /** Static value NotStarted for JobRunScanStatus. */ + public static final JobRunScanStatus NOT_STARTED = fromString("NotStarted"); + + /** Static value Scanning for JobRunScanStatus. */ + public static final JobRunScanStatus SCANNING = fromString("Scanning"); + + /** Static value Completed for JobRunScanStatus. */ + public static final JobRunScanStatus COMPLETED = fromString("Completed"); + + /** + * Creates or finds a JobRunScanStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobRunScanStatus. + */ + @JsonCreator + public static JobRunScanStatus fromString(String name) { + return fromString(name, JobRunScanStatus.class); + } + + /** + * Gets known JobRunScanStatus values. + * + * @return known JobRunScanStatus values. + */ + public static Collection values() { + return values(JobRunScanStatus.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java new file mode 100644 index 0000000000000..067bc4a6d9b16 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobRunStatus. */ +public final class JobRunStatus extends ExpandableStringEnum { + /** Static value Queued for JobRunStatus. */ + public static final JobRunStatus QUEUED = fromString("Queued"); + + /** Static value Started for JobRunStatus. */ + public static final JobRunStatus STARTED = fromString("Started"); + + /** Static value Running for JobRunStatus. */ + public static final JobRunStatus RUNNING = fromString("Running"); + + /** Static value CancelRequested for JobRunStatus. */ + public static final JobRunStatus CANCEL_REQUESTED = fromString("CancelRequested"); + + /** Static value Canceling for JobRunStatus. */ + public static final JobRunStatus CANCELING = fromString("Canceling"); + + /** Static value Canceled for JobRunStatus. */ + public static final JobRunStatus CANCELED = fromString("Canceled"); + + /** Static value Failed for JobRunStatus. */ + public static final JobRunStatus FAILED = fromString("Failed"); + + /** Static value Succeeded for JobRunStatus. */ + public static final JobRunStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Creates or finds a JobRunStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobRunStatus. + */ + @JsonCreator + public static JobRunStatus fromString(String name) { + return fromString(name, JobRunStatus.class); + } + + /** + * Gets known JobRunStatus values. + * + * @return known JobRunStatus values. + */ + public static Collection values() { + return values(JobRunStatus.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRuns.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRuns.java new file mode 100644 index 0000000000000..18580fa66ac62 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRuns.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobRuns. */ +public interface JobRuns { + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String storageMoverName, String projectName, String jobDefinitionName); + + /** + * Lists all job runs in a job definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of job runs as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + Context context); + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource. + */ + JobRun get( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName); + + /** + * Gets a job run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param jobDefinitionName The name of the job definition resource. + * @param jobRunName The name of the job run. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job run resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String storageMoverName, + String projectName, + String jobDefinitionName, + String jobRunName, + Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java new file mode 100644 index 0000000000000..45df95d9d885a --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The NfsMountEndpointProperties model. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "endpointType") +@JsonTypeName("NfsMount") +@Fluent +public final class NfsMountEndpointProperties extends EndpointBaseProperties { + /* + * The host name or IP address of the server exporting the file system. + */ + @JsonProperty(value = "host", required = true) + private String host; + + /* + * The NFS protocol version. + */ + @JsonProperty(value = "nfsVersion") + private NfsVersion nfsVersion; + + /* + * The directory being exported from the server. + */ + @JsonProperty(value = "remoteExport", required = true) + private String remoteExport; + + /** + * Get the host property: The host name or IP address of the server exporting the file system. + * + * @return the host value. + */ + public String host() { + return this.host; + } + + /** + * Set the host property: The host name or IP address of the server exporting the file system. + * + * @param host the host value to set. + * @return the NfsMountEndpointProperties object itself. + */ + public NfsMountEndpointProperties withHost(String host) { + this.host = host; + return this; + } + + /** + * Get the nfsVersion property: The NFS protocol version. + * + * @return the nfsVersion value. + */ + public NfsVersion nfsVersion() { + return this.nfsVersion; + } + + /** + * Set the nfsVersion property: The NFS protocol version. + * + * @param nfsVersion the nfsVersion value to set. + * @return the NfsMountEndpointProperties object itself. + */ + public NfsMountEndpointProperties withNfsVersion(NfsVersion nfsVersion) { + this.nfsVersion = nfsVersion; + return this; + } + + /** + * Get the remoteExport property: The directory being exported from the server. + * + * @return the remoteExport value. + */ + public String remoteExport() { + return this.remoteExport; + } + + /** + * Set the remoteExport property: The directory being exported from the server. + * + * @param remoteExport the remoteExport value to set. + * @return the NfsMountEndpointProperties object itself. + */ + public NfsMountEndpointProperties withRemoteExport(String remoteExport) { + this.remoteExport = remoteExport; + return this; + } + + /** {@inheritDoc} */ + @Override + public NfsMountEndpointProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (host() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property host in model NfsMountEndpointProperties")); + } + if (remoteExport() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property remoteExport in model NfsMountEndpointProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NfsMountEndpointProperties.class); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java new file mode 100644 index 0000000000000..54de75aa63dea --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; + +/** The NfsMountEndpointUpdateProperties model. */ +@Fluent +public final class NfsMountEndpointUpdateProperties extends EndpointBaseUpdateProperties { + /** {@inheritDoc} */ + @Override + public NfsMountEndpointUpdateProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java new file mode 100644 index 0000000000000..18d78ee13ebe4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NfsVersion. */ +public final class NfsVersion extends ExpandableStringEnum { + /** Static value NFSauto for NfsVersion. */ + public static final NfsVersion NFSAUTO = fromString("NFSauto"); + + /** Static value NFSv3 for NfsVersion. */ + public static final NfsVersion NFSV3 = fromString("NFSv3"); + + /** Static value NFSv4 for NfsVersion. */ + public static final NfsVersion NFSV4 = fromString("NFSv4"); + + /** + * Creates or finds a NfsVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding NfsVersion. + */ + @JsonCreator + public static NfsVersion fromString(String name) { + return fromString(name, NfsVersion.class); + } + + /** + * Gets known NfsVersion values. + * + * @return known NfsVersion values. + */ + public static Collection values() { + return values(NfsVersion.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operation.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operation.java new file mode 100644 index 0000000000000..6f3b87c58398c --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java new file mode 100644 index 0000000000000..5587807d39cce --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. + * "Microsoft Monitoring Insights" or "Microsoft Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this + * operation. E.g. "Virtual Machines" or "Job Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for + * dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual + * Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for + * tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java new file mode 100644 index 0000000000000..a85d8e8910ad8 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operations.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operations.java new file mode 100644 index 0000000000000..d10bd918c0459 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java new file mode 100644 index 0000000000000..2c2cbab3ff9a7 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Origin. */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Project.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Project.java new file mode 100644 index 0000000000000..a247497add0d0 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Project.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; + +/** An immutable client-side representation of Project. */ +public interface Project { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: A description for the project. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.ProjectInner object. + * + * @return the inner object. + */ + ProjectInner innerModel(); + + /** The entirety of the Project definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Project definition stages. */ + interface DefinitionStages { + /** The first stage of the Project definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Project definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, storageMoverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @return the next definition stage. + */ + WithCreate withExistingStorageMover(String resourceGroupName, String storageMoverName); + } + /** + * The stage of the Project definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + Project create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Project create(Context context); + } + /** The stage of the Project definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the project.. + * + * @param description A description for the project. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + /** + * Begins update for the Project resource. + * + * @return the stage of resource update. + */ + Project.Update update(); + + /** The template for Project update. */ + interface Update extends UpdateStages.WithDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Project apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Project apply(Context context); + } + /** The Project update stages. */ + interface UpdateStages { + /** The stage of the Project update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the project.. + * + * @param description A description for the project. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Project refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Project refresh(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java new file mode 100644 index 0000000000000..1cab6eddc4eec --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of project resources. */ +@Immutable +public final class ProjectList { + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of containers. Returned + * when total number of requested containers exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of containers. Returned when total + * number of requested containers exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java new file mode 100644 index 0000000000000..4461ef3317c08 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.fluent.models.ProjectUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The project resource. */ +@Fluent +public final class ProjectUpdateParameters { + /* + * Project properties. + */ + @JsonProperty(value = "properties") + private ProjectUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Project properties. + * + * @return the innerProperties value. + */ + private ProjectUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: A description for the project. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the project. + * + * @param description the description value to set. + * @return the ProjectUpdateParameters object itself. + */ + public ProjectUpdateParameters withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Projects.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Projects.java new file mode 100644 index 0000000000000..1ebf30af33cb5 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Projects.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Projects. */ +public interface Projects { + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName); + + /** + * Lists all projects in a Storage Mover. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of project resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource. + */ + Project get(String resourceGroupName, String storageMoverName, String projectName); + + /** + * Gets a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String storageMoverName, String projectName, Context context); + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String projectName); + + /** + * Deletes a project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the project resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, String projectName, Context context); + + /** + * Gets a project resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response}. + */ + Project getById(String id); + + /** + * Gets a project resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a project resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a project resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a project resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Project resource. + * + * @param name resource name. + * @return the first stage of the new Project definition. + */ + Project.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java new file mode 100644 index 0000000000000..c10737b32b64d --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMover.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMover.java new file mode 100644 index 0000000000000..20a17c3870476 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMover.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; +import java.util.Map; + +/** An immutable client-side representation of StorageMover. */ +public interface StorageMover { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: A description for the Storage Mover. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provisioningState property: The provisioning state of this resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner object. + * + * @return the inner object. + */ + StorageMoverInner innerModel(); + + /** The entirety of the StorageMover definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The StorageMover definition stages. */ + interface DefinitionStages { + /** The first stage of the StorageMover definition. */ + interface Blank extends WithLocation { + } + /** The stage of the StorageMover definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the StorageMover definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the StorageMover definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageMover create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageMover create(Context context); + } + /** The stage of the StorageMover definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the StorageMover definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the Storage Mover.. + * + * @param description A description for the Storage Mover. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + /** + * Begins update for the StorageMover resource. + * + * @return the stage of resource update. + */ + StorageMover.Update update(); + + /** The template for StorageMover update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageMover apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageMover apply(Context context); + } + /** The StorageMover update stages. */ + interface UpdateStages { + /** The stage of the StorageMover update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the StorageMover update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description for the Storage Mover.. + * + * @param description A description for the Storage Mover. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageMover refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageMover refresh(Context context); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java new file mode 100644 index 0000000000000..a53fee7290e77 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Storage Movers. */ +@Immutable +public final class StorageMoverList { + /* + * The value property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of containers. Returned + * when total number of requested containers exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of containers. Returned when total + * number of requested containers exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java new file mode 100644 index 0000000000000..f0954766eaa49 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Storage Mover resource. */ +@Fluent +public final class StorageMoverUpdateParameters { + /* + * The resource specific properties for the Storage Mover resource. + */ + @JsonProperty(value = "properties") + private StorageMoverUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the innerProperties property: The resource specific properties for the Storage Mover resource. + * + * @return the innerProperties value. + */ + private StorageMoverUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the StorageMoverUpdateParameters object itself. + */ + public StorageMoverUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description property: A description for the Storage Mover. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description for the Storage Mover. + * + * @param description the description value to set. + * @return the StorageMoverUpdateParameters object itself. + */ + public StorageMoverUpdateParameters withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageMoverUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMovers.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMovers.java new file mode 100644 index 0000000000000..cfa26694b970b --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMovers.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of StorageMovers. */ +public interface StorageMovers { + /** + * Lists all Storage Movers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all Storage Movers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all Storage Movers in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Storage Movers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource. + */ + StorageMover getByResourceGroup(String resourceGroupName, String storageMoverName); + + /** + * Gets a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String storageMoverName, Context context); + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String storageMoverName); + + /** + * Deletes a Storage Mover resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageMoverName, Context context); + + /** + * Gets a Storage Mover resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response}. + */ + StorageMover getById(String id); + + /** + * Gets a Storage Mover resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Storage Mover resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Storage Mover resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a Storage Mover resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new StorageMover resource. + * + * @param name resource name. + * @return the first stage of the new StorageMover definition. + */ + StorageMover.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/package-info.java new file mode 100644 index 0000000000000..bc0a0828ecd8e --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for StorageMoverClient. The Azure Storage Mover REST API. */ +package com.azure.resourcemanager.storagemover.models; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/package-info.java new file mode 100644 index 0000000000000..b124c59595f40 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for StorageMoverClient. The Azure Storage Mover REST API. */ +package com.azure.resourcemanager.storagemover; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/module-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/module-info.java new file mode 100644 index 0000000000000..7862f4918ccb6 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.storagemover { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.storagemover; + exports com.azure.resourcemanager.storagemover.fluent; + exports com.azure.resourcemanager.storagemover.fluent.models; + exports com.azure.resourcemanager.storagemover.models; + + opens com.azure.resourcemanager.storagemover.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.storagemover.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsCreateOrUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3b61c82819eb3 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +/** Samples for Agents CreateOrUpdate. */ +public final class AgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json + */ + /** + * Sample code: Agents_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .agents() + .define("examples-agentName") + .withExistingStorageMover("examples-rg", "examples-storageMoverName") + .withDescription("Example Agent Description") + .withArcResourceId( + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.HybridCompute/machines/examples-hybridComputeName") + .withArcVmUuid("3bb2c024-eba9-4d18-9e7a-1d772fcc5fe9") + .create(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsDeleteSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsDeleteSamples.java new file mode 100644 index 0000000000000..45cb85120f3aa --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Agents Delete. */ +public final class AgentsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json + */ + /** + * Sample code: Agents_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.agents().delete("examples-rg", "examples-storageMoverName", "examples-agentName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsGetSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsGetSamples.java new file mode 100644 index 0000000000000..48c6843583a04 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Agents Get. */ +public final class AgentsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json + */ + /** + * Sample code: Agents_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .agents() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-agentName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsListSamples.java new file mode 100644 index 0000000000000..4a98c31d351f5 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Agents List. */ +public final class AgentsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json + */ + /** + * Sample code: Agents_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.agents().list("examples-rg", "examples-storageMoverName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsUpdateSamples.java new file mode 100644 index 0000000000000..e08f8f86165b4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/AgentsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.Agent; + +/** Samples for Agents Update. */ +public final class AgentsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json + */ + /** + * Sample code: Agents_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void agentsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + Agent resource = + manager + .agents() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-agentName", Context.NONE) + .getValue(); + resource.update().withDescription("Updated Agent Description").apply(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsCreateOrUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ba55595b0139c --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +/** Samples for Endpoints CreateOrUpdate. */ +public final class EndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json + */ + /** + * Sample code: Endpoints_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .endpoints() + .define("examples-endpointName") + .withExistingStorageMover("examples-rg", "examples-storageMoverName") + .create(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsDeleteSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsDeleteSamples.java new file mode 100644 index 0000000000000..826af5cafb485 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints Delete. */ +public final class EndpointsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json + */ + /** + * Sample code: Endpoints_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.endpoints().delete("examples-rg", "examples-storageMoverName", "examples-endpointName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsGetSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsGetSamples.java new file mode 100644 index 0000000000000..48339d2ec89df --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints Get. */ +public final class EndpointsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json + */ + /** + * Sample code: Endpoints_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .endpoints() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-endpointName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsListSamples.java new file mode 100644 index 0000000000000..c8ab61629bbfd --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints List. */ +public final class EndpointsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json + */ + /** + * Sample code: Endpoints_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.endpoints().list("examples-rg", "examples-storageMoverName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsUpdateSamples.java new file mode 100644 index 0000000000000..6a684c32be671 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/EndpointsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.Endpoint; + +/** Samples for Endpoints Update. */ +public final class EndpointsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json + */ + /** + * Sample code: Endpoints_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void endpointsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + Endpoint resource = + manager + .endpoints() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-endpointName", Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsCreateOrUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c512a56c2f4be --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +/** Samples for JobDefinitions CreateOrUpdate. */ +public final class JobDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json + */ + /** + * Sample code: JobDefinitions_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsCreateOrUpdate( + com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .define("examples-jobDefinitionName") + .withExistingProject("examples-rg", "examples-storageMoverName", "examples-projectName") + .withDescription("Example Job Definition Description") + .withSourceName("examples-sourceEndpointName") + .withSourceSubpath("/") + .withTargetName("examples-targetEndpointName") + .withTargetSubpath("/") + .withAgentName("migration-agent") + .create(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsDeleteSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsDeleteSamples.java new file mode 100644 index 0000000000000..8d8f7b93f03ac --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobDefinitions Delete. */ +public final class JobDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json + */ + /** + * Sample code: Projects_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .delete( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsGetSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsGetSamples.java new file mode 100644 index 0000000000000..24f1c0955ef29 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobDefinitions Get. */ +public final class JobDefinitionsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json + */ + /** + * Sample code: JobDefinitions_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .getWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsListSamples.java new file mode 100644 index 0000000000000..bd7d1d5b369e2 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobDefinitions List. */ +public final class JobDefinitionsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json + */ + /** + * Sample code: JobDefinitions_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.jobDefinitions().list("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStartJobSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStartJobSamples.java new file mode 100644 index 0000000000000..0dca2728771a5 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStartJobSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobDefinitions StartJob. */ +public final class JobDefinitionsStartJobSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json + */ + /** + * Sample code: JobDefinitions_StartJob. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsStartJob(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .startJobWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStopJobSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStopJobSamples.java new file mode 100644 index 0000000000000..c7339a7d2cadb --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsStopJobSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobDefinitions StopJob. */ +public final class JobDefinitionsStopJobSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json + */ + /** + * Sample code: JobDefinitions_StopJob. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsStopJob(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobDefinitions() + .stopJobWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsUpdateSamples.java new file mode 100644 index 0000000000000..5568c3f122540 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobDefinitionsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.JobDefinition; + +/** Samples for JobDefinitions Update. */ +public final class JobDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json + */ + /** + * Sample code: JobDefinitions_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobDefinitionsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + JobDefinition resource = + manager + .jobDefinitions() + .getWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE) + .getValue(); + resource + .update() + .withDescription("Updated Job Definition Description") + .withAgentName("updatedAgentName") + .apply(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsGetSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsGetSamples.java new file mode 100644 index 0000000000000..0a9b85bce7ff5 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobRuns Get. */ +public final class JobRunsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json + */ + /** + * Sample code: JobRuns_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobRunsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobRuns() + .getWithResponse( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + "examples-jobRunName", + Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsListSamples.java new file mode 100644 index 0000000000000..92da99d3bd600 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/JobRunsListSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for JobRuns List. */ +public final class JobRunsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json + */ + /** + * Sample code: JobRuns_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void jobRunsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .jobRuns() + .list( + "examples-rg", + "examples-storageMoverName", + "examples-projectName", + "examples-jobDefinitionName", + Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/OperationsListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..6ac4aee67d850 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void operationsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsCreateOrUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..553481c196cbf --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +/** Samples for Projects CreateOrUpdate. */ +public final class ProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json + */ + /** + * Sample code: Projects_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .projects() + .define("examples-projectName") + .withExistingStorageMover("examples-rg", "examples-storageMoverName") + .withDescription("Example Project Description") + .create(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsDeleteSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsDeleteSamples.java new file mode 100644 index 0000000000000..0a18389d4f2b4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects Delete. */ +public final class ProjectsDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json + */ + /** + * Sample code: Projects_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.projects().delete("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsGetSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsGetSamples.java new file mode 100644 index 0000000000000..fcefeb9626f55 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects Get. */ +public final class ProjectsGetSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json + */ + /** + * Sample code: Projects_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .projects() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsListSamples.java new file mode 100644 index 0000000000000..575bbf8e7928a --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects List. */ +public final class ProjectsListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json + */ + /** + * Sample code: Projects_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.projects().list("examples-rg", "examples-storageMoverName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsUpdateSamples.java new file mode 100644 index 0000000000000..809e791d91e05 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/ProjectsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.Project; + +/** Samples for Projects Update. */ +public final class ProjectsUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json + */ + /** + * Sample code: Projects_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void projectsUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + Project resource = + manager + .projects() + .getWithResponse("examples-rg", "examples-storageMoverName", "examples-projectName", Context.NONE) + .getValue(); + resource.update().withDescription("Example Project Description").apply(); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversCreateOrUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c2e988b28ec9b --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversCreateOrUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for StorageMovers CreateOrUpdate. */ +public final class StorageMoversCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json + */ + /** + * Sample code: StorageMovers_CreateOrUpdate. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversCreateOrUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .storageMovers() + .define("examples-storageMoverName") + .withRegion("eastus2") + .withExistingResourceGroup("examples-rg") + .withTags(mapOf("key1", "value1", "key2", "value2")) + .withDescription("Example Storage Mover Description") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversDeleteSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversDeleteSamples.java new file mode 100644 index 0000000000000..729f6ea060a7a --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageMovers Delete. */ +public final class StorageMoversDeleteSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json + */ + /** + * Sample code: StorageMovers_Delete. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversDelete(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.storageMovers().delete("examples-rg", "examples-storageMoverName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversGetByResourceGroupSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..fb414f629ee75 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageMovers GetByResourceGroup. */ +public final class StorageMoversGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json + */ + /** + * Sample code: StorageMovers_Get. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversGet(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager + .storageMovers() + .getByResourceGroupWithResponse("examples-rg", "examples-storageMoverName", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListByResourceGroupSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListByResourceGroupSamples.java new file mode 100644 index 0000000000000..400ee36096878 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageMovers ListByResourceGroup. */ +public final class StorageMoversListByResourceGroupSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json + */ + /** + * Sample code: StorageMovers_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.storageMovers().listByResourceGroup("examples-rg", Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListSamples.java new file mode 100644 index 0000000000000..9b9df86a0a4f8 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageMovers List. */ +public final class StorageMoversListSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json + */ + /** + * Sample code: StorageMovers_List. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversList(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + manager.storageMovers().list(Context.NONE); + } +} diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversUpdateSamples.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversUpdateSamples.java new file mode 100644 index 0000000000000..1a2dd97a490a4 --- /dev/null +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/samples/java/com/azure/resourcemanager/storagemover/generated/StorageMoversUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagemover.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagemover.models.StorageMover; + +/** Samples for StorageMovers Update. */ +public final class StorageMoversUpdateSamples { + /* + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.json + */ + /** + * Sample code: StorageMovers_Update. + * + * @param manager Entry point to StorageMoverManager. + */ + public static void storageMoversUpdate(com.azure.resourcemanager.storagemover.StorageMoverManager manager) { + StorageMover resource = + manager + .storageMovers() + .getByResourceGroupWithResponse("examples-rg", "examples-storageMoverName", Context.NONE) + .getValue(); + resource.update().withDescription("Updated Storage Mover Description").apply(); + } +} diff --git a/sdk/storagemover/ci.yml b/sdk/storagemover/ci.yml new file mode 100644 index 0000000000000..bf608eb749aff --- /dev/null +++ b/sdk/storagemover/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/storagemover/ci.yml + - sdk/storagemover/azure-resourcemanager-storagemover/ + exclude: + - sdk/storagemover/pom.xml + - sdk/storagemover/azure-resourcemanager-storagemover/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagemover/ci.yml + - sdk/storagemover/azure-resourcemanager-storagemover/ + exclude: + - sdk/storagemover/pom.xml + - sdk/storagemover/azure-resourcemanager-storagemover/pom.xml + +parameters: + - name: release_azureresourcemanagerstoragemover + displayName: azure-resourcemanager-storagemover + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagemover + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-storagemover + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerstoragemover + releaseInBatch: ${{ parameters.release_azureresourcemanagerstoragemover }} diff --git a/sdk/storagemover/pom.xml b/sdk/storagemover/pom.xml new file mode 100644 index 0000000000000..7369e03a26287 --- /dev/null +++ b/sdk/storagemover/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-storagemover-service + pom + 1.0.0 + + + azure-resourcemanager-storagemover + +