From 1b302d2d140f75628374a14e563870321bf32a91 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 12 Mar 2024 08:34:26 +0000 Subject: [PATCH 1/2] [Automation] External Change --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + sdk/storageactions/ci.yml | 47 +++++++++++++++++++++++++++++++ sdk/storageactions/pom.xml | 15 ++++++++++ 4 files changed, 64 insertions(+) create mode 100644 sdk/storageactions/ci.yml create mode 100644 sdk/storageactions/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c0689ffd3643..ae958c9d664e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -449,6 +449,7 @@ com.azure.resourcemanager:azure-resourcemanager-astro;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-workloadssapvirtualinstance;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-largeinstance;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-migrationdiscoverysap;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-storageactions;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;1.1.0-beta.1 diff --git a/pom.xml b/pom.xml index 7efa9f98ff66..00c980668977 100644 --- a/pom.xml +++ b/pom.xml @@ -191,6 +191,7 @@ sdk/springappdiscovery sdk/sqlvirtualmachine sdk/storage + sdk/storageactions sdk/storagecache sdk/storageimportexport sdk/storagemover diff --git a/sdk/storageactions/ci.yml b/sdk/storageactions/ci.yml new file mode 100644 index 000000000000..cdbb9f2c1c14 --- /dev/null +++ b/sdk/storageactions/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/storageactions/ci.yml + - sdk/storageactions/azure-resourcemanager-storageactions/ + exclude: + - sdk/storageactions/pom.xml + - sdk/storageactions/azure-resourcemanager-storageactions/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storageactions/ci.yml + - sdk/storageactions/azure-resourcemanager-storageactions/ + exclude: + - sdk/storageactions/pom.xml + - sdk/storageactions/azure-resourcemanager-storageactions/pom.xml + +parameters: + - name: release_azureresourcemanagerstorageactions + displayName: azure-resourcemanager-storageactions + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storageactions + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-storageactions + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerstorageactions + releaseInBatch: ${{ parameters.release_azureresourcemanagerstorageactions }} diff --git a/sdk/storageactions/pom.xml b/sdk/storageactions/pom.xml new file mode 100644 index 000000000000..eee578024b2c --- /dev/null +++ b/sdk/storageactions/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-storageactions-service + pom + 1.0.0 + + + azure-resourcemanager-storageactions + + From e4f6c49c78b75d55b79ba926b09fc9098b263881 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 12 Mar 2024 08:34:31 +0000 Subject: [PATCH 2/2] [Automation] Generate Fluent Lite from storageactions#package-2023-01-01 --- .../CHANGELOG.md | 5 + .../README.md | 107 ++ .../SAMPLE.md | 392 +++++ .../pom.xml | 110 ++ .../storageactions/StorageActionsManager.java | 312 ++++ .../fluent/OperationsClient.java | 40 + .../fluent/StorageActionsMgmtClient.java | 76 + .../fluent/StorageTaskAssignmentsClient.java | 48 + .../fluent/StorageTasksClient.java | 324 ++++ .../fluent/StorageTasksReportsClient.java | 49 + .../fluent/models/OperationInner.java | 129 ++ .../models/StorageTaskAssignmentInner.java | 43 + .../fluent/models/StorageTaskInner.java | 124 ++ .../models/StorageTaskPreviewActionInner.java | 64 + .../StorageTaskReportInstanceInner.java | 75 + .../fluent/models/package-info.java | 9 + .../storageactions/fluent/package-info.java | 9 + .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 239 +++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 197 +++ .../StorageActionsMgmtClientBuilder.java | 136 ++ .../StorageActionsMgmtClientImpl.java | 335 ++++ .../StorageTaskAssignmentImpl.java | 32 + .../StorageTaskAssignmentsClientImpl.java | 321 ++++ .../StorageTaskAssignmentsImpl.java | 47 + .../implementation/StorageTaskImpl.java | 189 +++ .../StorageTaskPreviewActionImpl.java | 33 + .../StorageTaskReportInstanceImpl.java | 50 + .../StorageTasksClientImpl.java | 1487 +++++++++++++++++ .../implementation/StorageTasksImpl.java | 169 ++ .../StorageTasksReportsClientImpl.java | 330 ++++ .../StorageTasksReportsImpl.java | 48 + .../implementation/package-info.java | 9 + .../storageactions/models/ActionType.java | 48 + .../storageactions/models/ElseCondition.java | 64 + .../storageactions/models/IfCondition.java | 96 ++ .../models/ManagedServiceIdentity.java | 144 ++ .../models/ManagedServiceIdentityType.java | 64 + .../models/MatchedBlockName.java | 58 + .../storageactions/models/OnFailure.java | 56 + .../storageactions/models/OnSuccess.java | 56 + .../storageactions/models/Operation.java | 58 + .../models/OperationDisplay.java | 95 ++ .../models/OperationListResult.java | 64 + .../storageactions/models/Operations.java | 35 + .../storageactions/models/Origin.java | 59 + .../models/ProvisioningState.java | 86 + .../storageactions/models/RunResult.java | 53 + .../storageactions/models/RunStatusEnum.java | 53 + .../storageactions/models/StorageTask.java | 305 ++++ .../models/StorageTaskAction.java | 92 + .../models/StorageTaskAssignment.java | 26 + .../models/StorageTaskAssignments.java | 43 + .../StorageTaskAssignmentsListResult.java | 65 + .../models/StorageTaskOperation.java | 142 ++ .../models/StorageTaskOperationName.java | 78 + .../models/StorageTaskPreviewAction.java | 26 + .../StorageTaskPreviewActionCondition.java | 89 + .../StorageTaskPreviewActionIfCondition.java | 54 + .../StorageTaskPreviewActionProperties.java | 134 ++ .../StorageTaskPreviewBlobProperties.java | 157 ++ ...StorageTaskPreviewContainerProperties.java | 84 + .../StorageTaskPreviewKeyValueProperties.java | 80 + .../models/StorageTaskProperties.java | 165 ++ .../models/StorageTaskReportInstance.java | 55 + .../models/StorageTaskReportProperties.java | 281 ++++ .../models/StorageTaskReportSummary.java | 65 + .../models/StorageTaskUpdateParameters.java | 123 ++ .../storageactions/models/StorageTasks.java | 189 +++ .../models/StorageTasksListResult.java | 65 + .../models/StorageTasksReports.java | 44 + .../models/UserAssignedIdentity.java | 59 + .../storageactions/models/package-info.java | 9 + .../storageactions/package-info.java | 9 + .../src/main/java/module-info.java | 13 + .../proxy-config.json | 1 + .../reflect-config.json | 176 ++ .../generated/OperationsListSamples.java | 24 + .../StorageTaskAssignmentListSamples.java | 25 + .../generated/StorageTasksCreateSamples.java | 58 + .../generated/StorageTasksDeleteSamples.java | 24 + ...StorageTasksGetByResourceGroupSamples.java | 24 + ...torageTasksListByResourceGroupSamples.java | 25 + .../generated/StorageTasksListSamples.java | 25 + .../StorageTasksPreviewActionsSamples.java | 87 + .../StorageTasksReportListSamples.java | 25 + .../generated/StorageTasksUpdateSamples.java | 61 + .../generated/ElseConditionTests.java | 53 + .../generated/IfConditionTests.java | 65 + .../ManagedServiceIdentityTests.java | 43 + .../generated/OperationDisplayTests.java | 23 + .../generated/OperationInnerTests.java | 24 + .../generated/OperationListResultTests.java | 23 + .../generated/OperationsListMockTests.java | 54 + .../generated/StorageTaskActionTests.java | 88 + .../StorageTaskAssignmentInnerTests.java | 22 + .../StorageTaskAssignmentsListMockTests.java | 54 + ...StorageTaskAssignmentsListResultTests.java | 24 + .../generated/StorageTaskInnerTests.java | 122 ++ .../generated/StorageTaskOperationTests.java | 52 + ...torageTaskPreviewActionConditionTests.java | 30 + ...rageTaskPreviewActionIfConditionTests.java | 26 + .../generated/StorageTaskPropertiesTests.java | 94 ++ .../StorageTaskReportInstanceInnerTests.java | 25 + .../StorageTaskReportPropertiesTests.java | 23 + .../StorageTaskReportSummaryTests.java | 23 + .../StorageTaskUpdateParametersTests.java | 118 ++ .../StorageTasksCreateMockTests.java | 106 ++ ...tByResourceGroupWithResponseMockTests.java | 67 + ...rageTasksListByResourceGroupMockTests.java | 69 + .../generated/StorageTasksListMockTests.java | 68 + .../StorageTasksListResultTests.java | 23 + .../StorageTasksReportsListMockTests.java | 55 + .../generated/UserAssignedIdentityTests.java | 23 + .../org.mockito.plugins.MockMaker | 1 + 116 files changed, 11128 insertions(+) create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/CHANGELOG.md create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/README.md create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/SAMPLE.md create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/pom.xml create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/StorageActionsManager.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/OperationsClient.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageActionsMgmtClient.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTaskAssignmentsClient.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksClient.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksReportsClient.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/OperationInner.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskAssignmentInner.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskInner.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskPreviewActionInner.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskReportInstanceInner.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/package-info.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/package-info.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsClientImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/ResourceManagerUtils.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientBuilder.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsClientImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskPreviewActionImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskReportInstanceImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksClientImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsClientImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsImpl.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/package-info.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ActionType.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ElseCondition.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/IfCondition.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentity.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentityType.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/MatchedBlockName.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnFailure.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnSuccess.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operation.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationDisplay.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationListResult.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operations.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Origin.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ProvisioningState.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunResult.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunStatusEnum.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTask.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAction.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignment.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignments.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignmentsListResult.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperation.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperationName.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewAction.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionCondition.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionIfCondition.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionProperties.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewBlobProperties.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewContainerProperties.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewKeyValueProperties.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskProperties.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportInstance.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportProperties.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportSummary.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskUpdateParameters.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasks.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksListResult.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksReports.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/UserAssignedIdentity.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/package-info.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/package-info.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/module-info.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/proxy-config.json create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/reflect-config.json create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/OperationsListSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentListSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksDeleteSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksPreviewActionsSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportListSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksUpdateSamples.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ElseConditionTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/IfConditionTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ManagedServiceIdentityTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationDisplayTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationInnerTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationListResultTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationsListMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskActionTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentInnerTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListResultTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskInnerTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskOperationTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionConditionTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionIfConditionTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPropertiesTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportInstanceInnerTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportPropertiesTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportSummaryTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskUpdateParametersTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListResultTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportsListMockTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/UserAssignedIdentityTests.java create mode 100644 sdk/storageactions/azure-resourcemanager-storageactions/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/CHANGELOG.md b/sdk/storageactions/azure-resourcemanager-storageactions/CHANGELOG.md new file mode 100644 index 000000000000..0001177193c6 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-03-12) + +- Azure Resource Manager StorageActions client library for Java. This package contains Microsoft Azure SDK for StorageActions Management SDK. The Azure Storage Actions Management API. Package tag package-2023-01-01. 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/storageactions/azure-resourcemanager-storageactions/README.md b/sdk/storageactions/azure-resourcemanager-storageactions/README.md new file mode 100644 index 000000000000..27700ca8178a --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager StorageActions client library for Java + +Azure Resource Manager StorageActions client library for Java. + +This package contains Microsoft Azure SDK for StorageActions Management SDK. The Azure Storage Actions Management API. Package tag package-2023-01-01. 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-storageactions;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-storageactions + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Microsoft Entra ID token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +StorageActionsManager manager = StorageActionsManager + .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/storageactions/azure-resourcemanager-storageactions/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fstorageactions%2Fazure-resourcemanager-storageactions%2FREADME.png) diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/SAMPLE.md b/sdk/storageactions/azure-resourcemanager-storageactions/SAMPLE.md new file mode 100644 index 000000000000..dfca5159334b --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/SAMPLE.md @@ -0,0 +1,392 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## StorageTaskAssignment + +- [List](#storagetaskassignment_list) + +## StorageTasks + +- [Create](#storagetasks_create) +- [Delete](#storagetasks_delete) +- [GetByResourceGroup](#storagetasks_getbyresourcegroup) +- [List](#storagetasks_list) +- [ListByResourceGroup](#storagetasks_listbyresourcegroup) +- [PreviewActions](#storagetasks_previewactions) +- [Update](#storagetasks_update) + +## StorageTasksReport + +- [List](#storagetasksreport_list) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/ + * OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void operationsList(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTaskAssignment_List + +```java +/** + * Samples for StorageTaskAssignment List. + */ +public final class StorageTaskAssignmentListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTaskAssignmentIds.json + */ + /** + * Sample code: ListStorageTaskAssignmentsByResourceGroup. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void listStorageTaskAssignmentsByResourceGroup( + com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTaskAssignments().list("rgroup1", "mytask1", null, com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTasks_Create + +```java +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageTasks Create. + */ +public final class StorageTasksCreateSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/PutStorageTask.json + */ + /** + * Sample code: PutStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void putStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().define("mytask1").withRegion("westus").withExistingResourceGroup("res4228") + .withProperties(new StorageTaskProperties().withEnabled(true).withDescription("My Storage task") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("[[equals(AccessTier, 'Cool')]]") + .withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("tier", "Hot")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations( + Arrays.asList(new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))))) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### StorageTasks_Delete + +```java +/** + * Samples for StorageTasks Delete. + */ +public final class StorageTasksDeleteSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/DeleteStorageTask.json + */ + /** + * Sample code: DeleteStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void deleteStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().delete("res4228", "mytask1", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTasks_GetByResourceGroup + +```java +/** + * Samples for StorageTasks GetByResourceGroup. + */ +public final class StorageTasksGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/GetStorageTask.json + */ + /** + * Sample code: GetStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void getStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().getByResourceGroupWithResponse("res4228", "mytask1", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTasks_List + +```java +/** + * Samples for StorageTasks List. + */ +public final class StorageTasksListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTasksBySubscription.json + */ + /** + * Sample code: ListStorageTasksBySubscription. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + listStorageTasksBySubscription(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().list(com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTasks_ListByResourceGroup + +```java +/** + * Samples for StorageTasks ListByResourceGroup. + */ +public final class StorageTasksListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTasksByResourceGroup.json + */ + /** + * Sample code: ListStorageTasksByResourceGroup. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + listStorageTasksByResourceGroup(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().listByResourceGroup("res6117", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTasks_PreviewActions + +```java +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionCondition; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionIfCondition; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewBlobProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewContainerProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewKeyValueProperties; +import java.util.Arrays; + +/** + * Samples for StorageTasks PreviewActions. + */ +public final class StorageTasksPreviewActionsSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/ + * PerformStorageTaskActionsPreview.json + */ + /** + * Sample code: PerformStorageTaskActionsPreview. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + performStorageTaskActionsPreview(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().previewActionsWithResponse("eastus", + new StorageTaskPreviewActionInner().withProperties(new StorageTaskPreviewActionProperties() + .withContainer(new StorageTaskPreviewContainerProperties().withName("firstContainer") + .withMetadata(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("mContainerValue1")))) + .withBlobs(Arrays.asList( + new StorageTaskPreviewBlobProperties().withName("folder1/file1.txt").withProperties(Arrays.asList( + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 07 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 07 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("0x8DB67175454D36D"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("38619"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("text/xml"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("njr6iDrmU9+FC89WMK22EA=="), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("BlockBlob"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("Hot"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("true"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("unlocked"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("available"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("true"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("1"))) + .withMetadata(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("mValue1"))) + .withTags(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("tValue1"))), + new StorageTaskPreviewBlobProperties().withName("folder2/file1.txt") + .withProperties(Arrays.asList( + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 06 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 06 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("0x6FB67175454D36D"))) + .withMetadata(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("mValue2"))) + .withTags(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("tValue2"))))) + .withAction(new StorageTaskPreviewActionCondition() + .withIfProperty( + new StorageTaskPreviewActionIfCondition().withCondition("[[equals(AccessTier, 'Hot')]]")) + .withElseBlockExists(true))), + com.azure.core.util.Context.NONE); + } +} +``` + +### StorageTasks_Update + +```java +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageTasks Update. + */ +public final class StorageTasksUpdateSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/PatchStorageTask.json + */ + /** + * Sample code: PatchStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void patchStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + StorageTask resource = manager.storageTasks() + .getByResourceGroupWithResponse("res4228", "mytask1", com.azure.core.util.Context.NONE).getValue(); + resource.update() + .withProperties(new StorageTaskProperties().withEnabled(true).withDescription("My Storage task") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("[[equals(AccessTier, 'Cool')]]") + .withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("tier", "Hot")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations( + Arrays.asList(new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))))) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### StorageTasksReport_List + +```java +/** + * Samples for StorageTasksReport List. + */ +public final class StorageTasksReportListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTasksRunReportSummary.json + */ + /** + * Sample code: ListStorageTasksByResourceGroup. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + listStorageTasksByResourceGroup(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasksReports().list("rgroup1", "mytask1", null, null, com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml b/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml new file mode 100644 index 000000000000..8d4738641fa1 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml @@ -0,0 +1,110 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-storageactions + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for StorageActions Management + This package contains Microsoft Azure SDK for StorageActions Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Storage Actions Management API. Package tag package-2023-01-01. + 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 + 0 + 0 + true + + + + com.azure + azure-core + 1.47.0 + + + com.azure + azure-core-management + 1.12.0 + + + com.azure + azure-core-test + 1.24.0 + test + + + com.azure + azure-identity + 1.11.3 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.mockito + mockito-core + 4.11.0 + test + + + net.bytebuddy + byte-buddy + 1.14.8 + test + + + net.bytebuddy + byte-buddy-agent + 1.14.8 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/StorageActionsManager.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/StorageActionsManager.java new file mode 100644 index 000000000000..a27853009f26 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/StorageActionsManager.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions; + +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.storageactions.fluent.StorageActionsMgmtClient; +import com.azure.resourcemanager.storageactions.implementation.OperationsImpl; +import com.azure.resourcemanager.storageactions.implementation.StorageActionsMgmtClientBuilder; +import com.azure.resourcemanager.storageactions.implementation.StorageTaskAssignmentsImpl; +import com.azure.resourcemanager.storageactions.implementation.StorageTasksImpl; +import com.azure.resourcemanager.storageactions.implementation.StorageTasksReportsImpl; +import com.azure.resourcemanager.storageactions.models.Operations; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignments; +import com.azure.resourcemanager.storageactions.models.StorageTasks; +import com.azure.resourcemanager.storageactions.models.StorageTasksReports; +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 StorageActionsManager. + * The Azure Storage Actions Management API. + */ +public final class StorageActionsManager { + private Operations operations; + + private StorageTasks storageTasks; + + private StorageTaskAssignments storageTaskAssignments; + + private StorageTasksReports storageTasksReports; + + private final StorageActionsMgmtClient clientObject; + + private StorageActionsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new StorageActionsMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval).buildClient(); + } + + /** + * Creates an instance of StorageActions service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the StorageActions service API instance. + */ + public static StorageActionsManager 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 StorageActions service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the StorageActions service API instance. + */ + public static StorageActionsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new StorageActionsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create StorageActionsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new StorageActionsManager.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 StorageActions service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the StorageActions service API instance. + */ + public StorageActionsManager 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.storageactions") + .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 StorageActionsManager(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 StorageTasks. It manages StorageTask. + * + * @return Resource collection API of StorageTasks. + */ + public StorageTasks storageTasks() { + if (this.storageTasks == null) { + this.storageTasks = new StorageTasksImpl(clientObject.getStorageTasks(), this); + } + return storageTasks; + } + + /** + * Gets the resource collection API of StorageTaskAssignments. + * + * @return Resource collection API of StorageTaskAssignments. + */ + public StorageTaskAssignments storageTaskAssignments() { + if (this.storageTaskAssignments == null) { + this.storageTaskAssignments + = new StorageTaskAssignmentsImpl(clientObject.getStorageTaskAssignments(), this); + } + return storageTaskAssignments; + } + + /** + * Gets the resource collection API of StorageTasksReports. + * + * @return Resource collection API of StorageTasksReports. + */ + public StorageTasksReports storageTasksReports() { + if (this.storageTasksReports == null) { + this.storageTasksReports = new StorageTasksReportsImpl(clientObject.getStorageTasksReports(), this); + } + return storageTasksReports; + } + + /** + * Gets wrapped service client StorageActionsMgmtClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client StorageActionsMgmtClient. + */ + public StorageActionsMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/OperationsClient.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/OperationsClient.java new file mode 100644 index 000000000000..a3947f6b6c4d --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * Lists all of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageActionsMgmtClient.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageActionsMgmtClient.java new file mode 100644 index 000000000000..9026d03806e1 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageActionsMgmtClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for StorageActionsMgmtClient class. + */ +public interface StorageActionsMgmtClient { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @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 StorageTasksClient object to access its operations. + * + * @return the StorageTasksClient object. + */ + StorageTasksClient getStorageTasks(); + + /** + * Gets the StorageTaskAssignmentsClient object to access its operations. + * + * @return the StorageTaskAssignmentsClient object. + */ + StorageTaskAssignmentsClient getStorageTaskAssignments(); + + /** + * Gets the StorageTasksReportsClient object to access its operations. + * + * @return the StorageTasksReportsClient object. + */ + StorageTasksReportsClient getStorageTasksReports(); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTaskAssignmentsClient.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTaskAssignmentsClient.java new file mode 100644 index 000000000000..66617b5fe35e --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTaskAssignmentsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.models.StorageTaskAssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in StorageTaskAssignmentsClient. + */ +public interface StorageTaskAssignmentsClient { + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageTaskName); + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageTaskName, String maxpagesize, + Context context); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksClient.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksClient.java new file mode 100644 index 000000000000..02c8611c92c5 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksClient.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.models.StorageTaskInner; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined in StorageTasksClient. + */ +public interface StorageTasksClient { + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageTaskInner> beginCreate(String resourceGroupName, + String storageTaskName, StorageTaskInner parameters); + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageTaskInner> beginCreate(String resourceGroupName, + String storageTaskName, StorageTaskInner parameters, Context context); + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTaskInner create(String resourceGroupName, String storageTaskName, StorageTaskInner parameters); + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTaskInner create(String resourceGroupName, String storageTaskName, StorageTaskInner parameters, + Context context); + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName); + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, Context context); + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName); + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, Context context); + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String storageTaskName, + Context context); + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTaskInner getByResourceGroup(String resourceGroupName, String storageTaskName); + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageTaskInner> beginUpdate(String resourceGroupName, + String storageTaskName, StorageTaskUpdateParameters parameters); + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageTaskInner> beginUpdate(String resourceGroupName, + String storageTaskName, StorageTaskUpdateParameters parameters, Context context); + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTaskInner update(String resourceGroupName, String storageTaskName, StorageTaskUpdateParameters parameters); + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTaskInner update(String resourceGroupName, String storageTaskName, StorageTaskUpdateParameters parameters, + Context context); + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response previewActionsWithResponse(String location, + StorageTaskPreviewActionInner parameters, Context context); + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTaskPreviewActionInner previewActions(String location, StorageTaskPreviewActionInner parameters); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksReportsClient.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksReportsClient.java new file mode 100644 index 000000000000..659e9de56718 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/StorageTasksReportsClient.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.models.StorageTaskReportInstanceInner; + +/** + * An instance of this class provides access to all the operations defined in StorageTasksReportsClient. + */ +public interface StorageTasksReportsClient { + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageTaskName); + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String storageTaskName, + String maxpagesize, String filter, Context context); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/OperationInner.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/OperationInner.java new file mode 100644 index 000000000000..3ec0341cd4d5 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/OperationInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.storageactions.models.ActionType; +import com.azure.resourcemanager.storageactions.models.OperationDisplay; +import com.azure.resourcemanager.storageactions.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; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskAssignmentInner.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskAssignmentInner.java new file mode 100644 index 000000000000..72a68b8e80ac --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskAssignmentInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Fetch the Storage task assignment ARM ids. + */ +@Immutable +public final class StorageTaskAssignmentInner { + /* + * ARM Id of the storage task assignments, associated with the storage tasks. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Creates an instance of StorageTaskAssignmentInner class. + */ + public StorageTaskAssignmentInner() { + } + + /** + * Get the id property: ARM Id of the storage task assignments, associated with the storage tasks. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskInner.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskInner.java new file mode 100644 index 000000000000..d5a6d0f80e43 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskInner.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Represents Storage Task. + */ +@Fluent +public final class StorageTaskInner extends Resource { + /* + * The managed service identity of the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Properties of the storage task. + */ + @JsonProperty(value = "properties") + private StorageTaskProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of StorageTaskInner class. + */ + public StorageTaskInner() { + } + + /** + * Get the identity property: The managed service identity of the resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identity of the resource. + * + * @param identity the identity value to set. + * @return the StorageTaskInner object itself. + */ + public StorageTaskInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the properties property: Properties of the storage task. + * + * @return the properties value. + */ + public StorageTaskProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the storage task. + * + * @param properties the properties value to set. + * @return the StorageTaskInner object itself. + */ + public StorageTaskInner withProperties(StorageTaskProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageTaskInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageTaskInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskPreviewActionInner.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskPreviewActionInner.java new file mode 100644 index 000000000000..074be25822de --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskPreviewActionInner.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage Task Preview Action. + */ +@Fluent +public final class StorageTaskPreviewActionInner { + /* + * Properties of the storage task preview. + */ + @JsonProperty(value = "properties", required = true) + private StorageTaskPreviewActionProperties properties; + + /** + * Creates an instance of StorageTaskPreviewActionInner class. + */ + public StorageTaskPreviewActionInner() { + } + + /** + * Get the properties property: Properties of the storage task preview. + * + * @return the properties value. + */ + public StorageTaskPreviewActionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the storage task preview. + * + * @param properties the properties value to set. + * @return the StorageTaskPreviewActionInner object itself. + */ + public StorageTaskPreviewActionInner withProperties(StorageTaskPreviewActionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property properties in model StorageTaskPreviewActionInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskPreviewActionInner.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskReportInstanceInner.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskReportInstanceInner.java new file mode 100644 index 000000000000..60a7c756a67f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/StorageTaskReportInstanceInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage Tasks run report instance. + */ +@Fluent +public final class StorageTaskReportInstanceInner extends ProxyResource { + /* + * Storage task execution report for a run instance. + */ + @JsonProperty(value = "properties") + private StorageTaskReportProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of StorageTaskReportInstanceInner class. + */ + public StorageTaskReportInstanceInner() { + } + + /** + * Get the properties property: Storage task execution report for a run instance. + * + * @return the properties value. + */ + public StorageTaskReportProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Storage task execution report for a run instance. + * + * @param properties the properties value to set. + * @return the StorageTaskReportInstanceInner object itself. + */ + public StorageTaskReportInstanceInner withProperties(StorageTaskReportProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/package-info.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/package-info.java new file mode 100644 index 000000000000..62c75a487a6f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 StorageActionsMgmtClient. + * The Azure Storage Actions Management API. + */ +package com.azure.resourcemanager.storageactions.fluent.models; diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/package-info.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/package-info.java new file mode 100644 index 000000000000..7f6af6f52cb1 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 StorageActionsMgmtClient. + * The Azure Storage Actions Management API. + */ +package com.azure.resourcemanager.storageactions.fluent; diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationImpl.java new file mode 100644 index 000000000000..2d5d3e2b2e36 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/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.storageactions.implementation; + +import com.azure.resourcemanager.storageactions.fluent.models.OperationInner; +import com.azure.resourcemanager.storageactions.models.ActionType; +import com.azure.resourcemanager.storageactions.models.Operation; +import com.azure.resourcemanager.storageactions.models.OperationDisplay; +import com.azure.resourcemanager.storageactions.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.storageactions.StorageActionsManager 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.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsClientImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..c492e74f9672 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsClientImpl.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.storageactions.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.storageactions.fluent.OperationsClient; +import com.azure.resourcemanager.storageactions.fluent.models.OperationInner; +import com.azure.resourcemanager.storageactions.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 StorageActionsMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(StorageActionsMgmtClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageActionsMgmtClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageActionsMgmtCl") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.StorageActions/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 of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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 URL to get the next list of items + * + * 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 URL to get the next list of items + * + * 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/OperationsImpl.java new file mode 100644 index 000000000000..acff497f39d0 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/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.storageactions.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.storageactions.fluent.OperationsClient; +import com.azure.resourcemanager.storageactions.fluent.models.OperationInner; +import com.azure.resourcemanager.storageactions.models.Operation; +import com.azure.resourcemanager.storageactions.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.storageactions.StorageActionsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/ResourceManagerUtils.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..a2a1d6eff9bd --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/ResourceManagerUtils.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientBuilder.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientBuilder.java new file mode 100644 index 000000000000..e25e23d93595 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientBuilder.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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 StorageActionsMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { StorageActionsMgmtClientImpl.class }) +public final class StorageActionsMgmtClientBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the StorageActionsMgmtClientBuilder. + */ + public StorageActionsMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the StorageActionsMgmtClientBuilder. + */ + public StorageActionsMgmtClientBuilder 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 StorageActionsMgmtClientBuilder. + */ + public StorageActionsMgmtClientBuilder 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 StorageActionsMgmtClientBuilder. + */ + public StorageActionsMgmtClientBuilder 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 StorageActionsMgmtClientBuilder. + */ + public StorageActionsMgmtClientBuilder 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 StorageActionsMgmtClientBuilder. + */ + public StorageActionsMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of StorageActionsMgmtClientImpl with the provided parameters. + * + * @return an instance of StorageActionsMgmtClientImpl. + */ + public StorageActionsMgmtClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + StorageActionsMgmtClientImpl client = new StorageActionsMgmtClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientImpl.java new file mode 100644 index 000000000000..c912f2df07e6 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageActionsMgmtClientImpl.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.storageactions.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.storageactions.fluent.OperationsClient; +import com.azure.resourcemanager.storageactions.fluent.StorageActionsMgmtClient; +import com.azure.resourcemanager.storageactions.fluent.StorageTaskAssignmentsClient; +import com.azure.resourcemanager.storageactions.fluent.StorageTasksClient; +import com.azure.resourcemanager.storageactions.fluent.StorageTasksReportsClient; +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 StorageActionsMgmtClientImpl type. + */ +@ServiceClient(builder = StorageActionsMgmtClientBuilder.class) +public final class StorageActionsMgmtClientImpl implements StorageActionsMgmtClient { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @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 StorageTasksClient object to access its operations. + */ + private final StorageTasksClient storageTasks; + + /** + * Gets the StorageTasksClient object to access its operations. + * + * @return the StorageTasksClient object. + */ + public StorageTasksClient getStorageTasks() { + return this.storageTasks; + } + + /** + * The StorageTaskAssignmentsClient object to access its operations. + */ + private final StorageTaskAssignmentsClient storageTaskAssignments; + + /** + * Gets the StorageTaskAssignmentsClient object to access its operations. + * + * @return the StorageTaskAssignmentsClient object. + */ + public StorageTaskAssignmentsClient getStorageTaskAssignments() { + return this.storageTaskAssignments; + } + + /** + * The StorageTasksReportsClient object to access its operations. + */ + private final StorageTasksReportsClient storageTasksReports; + + /** + * Gets the StorageTasksReportsClient object to access its operations. + * + * @return the StorageTasksReportsClient object. + */ + public StorageTasksReportsClient getStorageTasksReports() { + return this.storageTasksReports; + } + + /** + * Initializes an instance of StorageActionsMgmtClient 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. The value must be an UUID. + * @param endpoint server parameter. + */ + StorageActionsMgmtClientImpl(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 = "2023-01-01"; + this.operations = new OperationsClientImpl(this); + this.storageTasks = new StorageTasksClientImpl(this); + this.storageTaskAssignments = new StorageTaskAssignmentsClientImpl(this); + this.storageTasksReports = new StorageTasksReportsClientImpl(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(StorageActionsMgmtClientImpl.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentImpl.java new file mode 100644 index 000000000000..10a32260d52e --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentImpl.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.storageactions.implementation; + +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignment; + +public final class StorageTaskAssignmentImpl implements StorageTaskAssignment { + private StorageTaskAssignmentInner innerObject; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + StorageTaskAssignmentImpl(StorageTaskAssignmentInner innerObject, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public StorageTaskAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsClientImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsClientImpl.java new file mode 100644 index 000000000000..e2278b82f4a6 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsClientImpl.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.storageactions.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.storageactions.fluent.StorageTaskAssignmentsClient; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignmentsListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StorageTaskAssignmentsClient. + */ +public final class StorageTaskAssignmentsClientImpl implements StorageTaskAssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageTaskAssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final StorageActionsMgmtClientImpl client; + + /** + * Initializes an instance of StorageTaskAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageTaskAssignmentsClientImpl(StorageActionsMgmtClientImpl client) { + this.service = RestProxy.create(StorageTaskAssignmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageActionsMgmtClientStorageTaskAssignments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageActionsMgmtCl") + public interface StorageTaskAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageTaskName") String storageTaskName, @QueryParam("$maxpagesize") String maxpagesize, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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 storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String storageTaskName, String maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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(), resourceGroupName, storageTaskName, + maxpagesize, this.client.getApiVersion(), this.client.getSubscriptionId(), 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 storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String storageTaskName, String maxpagesize, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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(), resourceGroupName, storageTaskName, maxpagesize, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageTaskName, + String maxpagesize) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, storageTaskName, maxpagesize), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageTaskName) { + final String maxpagesize = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, storageTaskName, maxpagesize), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageTaskName, + String maxpagesize, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, storageTaskName, maxpagesize, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageTaskName) { + final String maxpagesize = null; + return new PagedIterable<>(listAsync(resourceGroupName, storageTaskName, maxpagesize)); + } + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageTaskName, + String maxpagesize, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, storageTaskName, maxpagesize, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * 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 the response from the List Storage Tasks operation 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 URL to get the next list of items + * + * 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 the response from the List Storage Tasks operation 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsImpl.java new file mode 100644 index 000000000000..c2b64253600a --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskAssignmentsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.StorageTaskAssignmentsClient; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignment; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignments; + +public final class StorageTaskAssignmentsImpl implements StorageTaskAssignments { + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskAssignmentsImpl.class); + + private final StorageTaskAssignmentsClient innerClient; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + public StorageTaskAssignmentsImpl(StorageTaskAssignmentsClient innerClient, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String storageTaskName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, storageTaskName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String storageTaskName, + String maxpagesize, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, storageTaskName, maxpagesize, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskAssignmentImpl(inner1, this.manager())); + } + + private StorageTaskAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskImpl.java new file mode 100644 index 000000000000..de6f6a9f1079 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskUpdateParameters; +import java.util.Collections; +import java.util.Map; + +public final class StorageTaskImpl implements StorageTask, StorageTask.Definition, StorageTask.Update { + private StorageTaskInner innerObject; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public StorageTaskProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public StorageTaskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageTaskName; + + private StorageTaskUpdateParameters updateParameters; + + public StorageTaskImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public StorageTask create() { + this.innerObject = serviceManager.serviceClient().getStorageTasks().create(resourceGroupName, storageTaskName, + this.innerModel(), Context.NONE); + return this; + } + + public StorageTask create(Context context) { + this.innerObject = serviceManager.serviceClient().getStorageTasks().create(resourceGroupName, storageTaskName, + this.innerModel(), context); + return this; + } + + StorageTaskImpl(String name, com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerObject = new StorageTaskInner(); + this.serviceManager = serviceManager; + this.storageTaskName = name; + } + + public StorageTaskImpl update() { + this.updateParameters = new StorageTaskUpdateParameters(); + return this; + } + + public StorageTask apply() { + this.innerObject = serviceManager.serviceClient().getStorageTasks().update(resourceGroupName, storageTaskName, + updateParameters, Context.NONE); + return this; + } + + public StorageTask apply(Context context) { + this.innerObject = serviceManager.serviceClient().getStorageTasks().update(resourceGroupName, storageTaskName, + updateParameters, context); + return this; + } + + StorageTaskImpl(StorageTaskInner innerObject, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageTaskName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "storageTasks"); + } + + public StorageTask refresh() { + this.innerObject = serviceManager.serviceClient().getStorageTasks() + .getByResourceGroupWithResponse(resourceGroupName, storageTaskName, Context.NONE).getValue(); + return this; + } + + public StorageTask refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getStorageTasks() + .getByResourceGroupWithResponse(resourceGroupName, storageTaskName, context).getValue(); + return this; + } + + public StorageTaskImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StorageTaskImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StorageTaskImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public StorageTaskImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public StorageTaskImpl withProperties(StorageTaskProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateParameters.withProperties(properties); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskPreviewActionImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskPreviewActionImpl.java new file mode 100644 index 000000000000..2f8e93761fde --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskPreviewActionImpl.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.storageactions.implementation; + +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionProperties; + +public final class StorageTaskPreviewActionImpl implements StorageTaskPreviewAction { + private StorageTaskPreviewActionInner innerObject; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + StorageTaskPreviewActionImpl(StorageTaskPreviewActionInner innerObject, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public StorageTaskPreviewActionProperties properties() { + return this.innerModel().properties(); + } + + public StorageTaskPreviewActionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskReportInstanceImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskReportInstanceImpl.java new file mode 100644 index 000000000000..da65db288bba --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTaskReportInstanceImpl.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.storageactions.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportInstance; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportProperties; + +public final class StorageTaskReportInstanceImpl implements StorageTaskReportInstance { + private StorageTaskReportInstanceInner innerObject; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + StorageTaskReportInstanceImpl(StorageTaskReportInstanceInner innerObject, + com.azure.resourcemanager.storageactions.StorageActionsManager 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 StorageTaskReportProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public StorageTaskReportInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksClientImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksClientImpl.java new file mode 100644 index 000000000000..7262654f5929 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksClientImpl.java @@ -0,0 +1,1487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.StorageTasksClient; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskUpdateParameters; +import com.azure.resourcemanager.storageactions.models.StorageTasksListResult; +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 StorageTasksClient. + */ +public final class StorageTasksClientImpl implements StorageTasksClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageTasksService service; + + /** + * The service client containing this operation class. + */ + private final StorageActionsMgmtClientImpl client; + + /** + * Initializes an instance of StorageTasksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageTasksClientImpl(StorageActionsMgmtClientImpl client) { + this.service + = RestProxy.create(StorageTasksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageActionsMgmtClientStorageTasks to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageActionsMgmtCl") + public interface StorageTasksService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageTaskName") String storageTaskName, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") StorageTaskInner parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageTaskName") String storageTaskName, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageTaskName") String storageTaskName, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageTaskName") String storageTaskName, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") StorageTaskUpdateParameters parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> previewActions(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @BodyParam("application/json") StorageTaskPreviewActionInner parameters, + @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> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String storageTaskName, + StorageTaskInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String storageTaskName, + StorageTaskInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageTaskInner> beginCreateAsync(String resourceGroupName, + String storageTaskName, StorageTaskInner parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, storageTaskName, parameters); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageTaskInner.class, StorageTaskInner.class, this.client.getContext()); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageTaskInner> beginCreateAsync(String resourceGroupName, + String storageTaskName, StorageTaskInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, storageTaskName, parameters, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageTaskInner.class, StorageTaskInner.class, context); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageTaskInner> beginCreate(String resourceGroupName, + String storageTaskName, StorageTaskInner parameters) { + return this.beginCreateAsync(resourceGroupName, storageTaskName, parameters).getSyncPoller(); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageTaskInner> beginCreate(String resourceGroupName, + String storageTaskName, StorageTaskInner parameters, Context context) { + return this.beginCreateAsync(resourceGroupName, storageTaskName, parameters, context).getSyncPoller(); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String storageTaskName, + StorageTaskInner parameters) { + return beginCreateAsync(resourceGroupName, storageTaskName, parameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String storageTaskName, + StorageTaskInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, storageTaskName, parameters, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTaskInner create(String resourceGroupName, String storageTaskName, StorageTaskInner parameters) { + return createAsync(resourceGroupName, storageTaskName, parameters).block(); + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already + * created and a subsequent create request is issued with different properties, the storage task properties will be + * updated. If a storage task is already created and a subsequent create or update request is issued with the exact + * same set of properties, the request will succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to create a Storage Task. + * @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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTaskInner create(String resourceGroupName, String storageTaskName, StorageTaskInner parameters, + Context context) { + return createAsync(resourceGroupName, storageTaskName, parameters, context).block(); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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.delete(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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.delete(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageTaskName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageTaskName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName) { + return this.beginDeleteAsync(resourceGroupName, storageTaskName).getSyncPoller(); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, storageTaskName, context).getSyncPoller(); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName) { + return beginDeleteAsync(resourceGroupName, storageTaskName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, Context context) { + return beginDeleteAsync(resourceGroupName, storageTaskName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName) { + deleteAsync(resourceGroupName, storageTaskName).block(); + } + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, Context context) { + deleteAsync(resourceGroupName, storageTaskName, context).block(); + } + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String storageTaskName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, + storageTaskName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String storageTaskName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String storageTaskName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, storageTaskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String storageTaskName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, storageTaskName, context).block(); + } + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTaskInner getByResourceGroup(String resourceGroupName, String storageTaskName) { + return getByResourceGroupWithResponse(resourceGroupName, storageTaskName, Context.NONE).getValue(); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String storageTaskName, + StorageTaskUpdateParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String storageTaskName, + StorageTaskUpdateParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), resourceGroupName, storageTaskName, + this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageTaskInner> beginUpdateAsync(String resourceGroupName, + String storageTaskName, StorageTaskUpdateParameters parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, storageTaskName, parameters); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageTaskInner.class, StorageTaskInner.class, this.client.getContext()); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageTaskInner> beginUpdateAsync(String resourceGroupName, + String storageTaskName, StorageTaskUpdateParameters parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, storageTaskName, parameters, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageTaskInner.class, StorageTaskInner.class, context); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageTaskInner> beginUpdate(String resourceGroupName, + String storageTaskName, StorageTaskUpdateParameters parameters) { + return this.beginUpdateAsync(resourceGroupName, storageTaskName, parameters).getSyncPoller(); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageTaskInner> beginUpdate(String resourceGroupName, + String storageTaskName, StorageTaskUpdateParameters parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, storageTaskName, parameters, context).getSyncPoller(); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String storageTaskName, + StorageTaskUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, storageTaskName, parameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String storageTaskName, + StorageTaskUpdateParameters parameters, Context context) { + return beginUpdateAsync(resourceGroupName, storageTaskName, parameters, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTaskInner update(String resourceGroupName, String storageTaskName, + StorageTaskUpdateParameters parameters) { + return updateAsync(resourceGroupName, storageTaskName, parameters).block(); + } + + /** + * Update storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide to update the storage task 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 represents Storage Task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTaskInner update(String resourceGroupName, String storageTaskName, + StorageTaskUpdateParameters parameters, Context context) { + return updateAsync(resourceGroupName, storageTaskName, parameters, context).block(); + } + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation 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.getApiVersion(), + this.client.getSubscriptionId(), 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 storage tasks available under the 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 the response from the List Storage Tasks operation 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.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation 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 the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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.listByResourceGroup(this.client.getEndpoint(), resourceGroupName, + this.client.getApiVersion(), this.client.getSubscriptionId(), 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 storage tasks available under the given 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 the response from the List Storage Tasks operation 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> previewActionsWithResponseAsync(String location, + StorageTaskPreviewActionInner parameters) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.previewActions(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> previewActionsWithResponseAsync(String location, + StorageTaskPreviewActionInner parameters, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.previewActions(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, parameters, accept, context); + } + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono previewActionsAsync(String location, + StorageTaskPreviewActionInner parameters) { + return previewActionsWithResponseAsync(location, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response previewActionsWithResponse(String location, + StorageTaskPreviewActionInner parameters, Context context) { + return previewActionsWithResponseAsync(location, parameters, context).block(); + } + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTaskPreviewActionInner previewActions(String location, StorageTaskPreviewActionInner parameters) { + return previewActionsWithResponse(location, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * 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 the response from the List Storage Tasks operation 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 URL to get the next list of items + * + * 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 the response from the List Storage Tasks operation 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 URL to get the next list of items + * + * 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 the response from the List Storage Tasks operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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 URL to get the next list of items + * + * 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 the response from the List Storage Tasks operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksImpl.java new file mode 100644 index 000000000000..361b20f46f6f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksImpl.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.storageactions.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.storageactions.fluent.StorageTasksClient; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewAction; +import com.azure.resourcemanager.storageactions.models.StorageTasks; + +public final class StorageTasksImpl implements StorageTasks { + private static final ClientLogger LOGGER = new ClientLogger(StorageTasksImpl.class); + + private final StorageTasksClient innerClient; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + public StorageTasksImpl(StorageTasksClient innerClient, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String storageTaskName) { + this.serviceClient().delete(resourceGroupName, storageTaskName); + } + + public void delete(String resourceGroupName, String storageTaskName, Context context) { + this.serviceClient().delete(resourceGroupName, storageTaskName, context); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String storageTaskName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, storageTaskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageTaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StorageTask getByResourceGroup(String resourceGroupName, String storageTaskName) { + StorageTaskInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, storageTaskName); + if (inner != null) { + return new StorageTaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskImpl(inner1, this.manager())); + } + + public Response previewActionsWithResponse(String location, + StorageTaskPreviewActionInner parameters, Context context) { + Response inner + = this.serviceClient().previewActionsWithResponse(location, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageTaskPreviewActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StorageTaskPreviewAction previewActions(String location, StorageTaskPreviewActionInner parameters) { + StorageTaskPreviewActionInner inner = this.serviceClient().previewActions(location, parameters); + if (inner != null) { + return new StorageTaskPreviewActionImpl(inner, this.manager()); + } else { + return null; + } + } + + public StorageTask getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 storageTaskName = ResourceManagerUtils.getValueFromIdByName(id, "storageTasks"); + if (storageTaskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageTasks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageTaskName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 storageTaskName = ResourceManagerUtils.getValueFromIdByName(id, "storageTasks"); + if (storageTaskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageTasks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageTaskName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 storageTaskName = ResourceManagerUtils.getValueFromIdByName(id, "storageTasks"); + if (storageTaskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageTasks'.", id))); + } + this.delete(resourceGroupName, storageTaskName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 storageTaskName = ResourceManagerUtils.getValueFromIdByName(id, "storageTasks"); + if (storageTaskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageTasks'.", id))); + } + this.delete(resourceGroupName, storageTaskName, context); + } + + private StorageTasksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } + + public StorageTaskImpl define(String name) { + return new StorageTaskImpl(name, this.manager()); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsClientImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsClientImpl.java new file mode 100644 index 000000000000..a4e5f968c98c --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsClientImpl.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.StorageTasksReportsClient; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportSummary; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StorageTasksReportsClient. + */ +public final class StorageTasksReportsClientImpl implements StorageTasksReportsClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageTasksReportsService service; + + /** + * The service client containing this operation class. + */ + private final StorageActionsMgmtClientImpl client; + + /** + * Initializes an instance of StorageTasksReportsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageTasksReportsClientImpl(StorageActionsMgmtClientImpl client) { + this.service = RestProxy.create(StorageTasksReportsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageActionsMgmtClientStorageTasksReports to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageActionsMgmtCl") + public interface StorageTasksReportsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageTaskName") String storageTaskName, @QueryParam("$maxpagesize") String maxpagesize, + @QueryParam("$filter") String filter, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @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); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String storageTaskName, String maxpagesize, String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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(), resourceGroupName, storageTaskName, + maxpagesize, filter, this.client.getApiVersion(), this.client.getSubscriptionId(), 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())); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String storageTaskName, String maxpagesize, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageTaskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTaskName 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(), resourceGroupName, storageTaskName, maxpagesize, filter, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageTaskName, + String maxpagesize, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, storageTaskName, maxpagesize, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageTaskName) { + final String maxpagesize = null; + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, storageTaskName, maxpagesize, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String storageTaskName, + String maxpagesize, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, storageTaskName, maxpagesize, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageTaskName) { + final String maxpagesize = null; + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, storageTaskName, maxpagesize, filter)); + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String storageTaskName, + String maxpagesize, String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, storageTaskName, maxpagesize, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * 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 fetch Storage Tasks Run Summary 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 URL to get the next list of items + * + * 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 fetch Storage Tasks Run Summary 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsImpl.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsImpl.java new file mode 100644 index 000000000000..da4b7f2af069 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/StorageTasksReportsImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.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.storageactions.fluent.StorageTasksReportsClient; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportInstance; +import com.azure.resourcemanager.storageactions.models.StorageTasksReports; + +public final class StorageTasksReportsImpl implements StorageTasksReports { + private static final ClientLogger LOGGER = new ClientLogger(StorageTasksReportsImpl.class); + + private final StorageTasksReportsClient innerClient; + + private final com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager; + + public StorageTasksReportsImpl(StorageTasksReportsClient innerClient, + com.azure.resourcemanager.storageactions.StorageActionsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String storageTaskName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, storageTaskName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskReportInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String storageTaskName, + String maxpagesize, String filter, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, storageTaskName, maxpagesize, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageTaskReportInstanceImpl(inner1, this.manager())); + } + + private StorageTasksReportsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storageactions.StorageActionsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/package-info.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/package-info.java new file mode 100644 index 000000000000..6d2cd3579d35 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 StorageActionsMgmtClient. + * The Azure Storage Actions Management API. + */ +package com.azure.resourcemanager.storageactions.implementation; diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ActionType.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ActionType.java new file mode 100644 index 000000000000..5129290ef94f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ActionType.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ElseCondition.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ElseCondition.java new file mode 100644 index 000000000000..4b0c596d8e0e --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ElseCondition.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The else block of storage task operation. + */ +@Fluent +public final class ElseCondition { + /* + * List of operations to execute in the else block + */ + @JsonProperty(value = "operations", required = true) + private List operations; + + /** + * Creates an instance of ElseCondition class. + */ + public ElseCondition() { + } + + /** + * Get the operations property: List of operations to execute in the else block. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: List of operations to execute in the else block. + * + * @param operations the operations value to set. + * @return the ElseCondition object itself. + */ + public ElseCondition withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operations() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property operations in model ElseCondition")); + } else { + operations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ElseCondition.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/IfCondition.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/IfCondition.java new file mode 100644 index 000000000000..a363a3639871 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/IfCondition.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.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The if block of storage task operation. + */ +@Fluent +public final class IfCondition { + /* + * The condition predicate which is composed of object properties, eg: blob and container properties. + */ + @JsonProperty(value = "condition", required = true) + private String condition; + + /* + * List of operations to execute when the condition predicate satisfies. + */ + @JsonProperty(value = "operations", required = true) + private List operations; + + /** + * Creates an instance of IfCondition class. + */ + public IfCondition() { + } + + /** + * Get the condition property: The condition predicate which is composed of object properties, eg: blob and + * container properties. + * + * @return the condition value. + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition property: The condition predicate which is composed of object properties, eg: blob and + * container properties. + * + * @param condition the condition value to set. + * @return the IfCondition object itself. + */ + public IfCondition withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the operations property: List of operations to execute when the condition predicate satisfies. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: List of operations to execute when the condition predicate satisfies. + * + * @param operations the operations value to set. + * @return the IfCondition object itself. + */ + public IfCondition withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (condition() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property condition in model IfCondition")); + } + if (operations() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property operations in model IfCondition")); + } else { + operations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IfCondition.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentity.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..15812da9a726 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentity.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided + * for a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentityType.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..bd4fc1a5846f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ManagedServiceIdentityType.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/MatchedBlockName.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/MatchedBlockName.java new file mode 100644 index 000000000000..cc83e3e4c555 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/MatchedBlockName.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.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Represents the condition block name that matched blob properties. + */ +public final class MatchedBlockName extends ExpandableStringEnum { + /** + * Static value If for MatchedBlockName. + */ + public static final MatchedBlockName IF = fromString("If"); + + /** + * Static value Else for MatchedBlockName. + */ + public static final MatchedBlockName ELSE = fromString("Else"); + + /** + * Static value None for MatchedBlockName. + */ + public static final MatchedBlockName NONE = fromString("None"); + + /** + * Creates a new instance of MatchedBlockName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MatchedBlockName() { + } + + /** + * Creates or finds a MatchedBlockName from its string representation. + * + * @param name a name to look for. + * @return the corresponding MatchedBlockName. + */ + @JsonCreator + public static MatchedBlockName fromString(String name) { + return fromString(name, MatchedBlockName.class); + } + + /** + * Gets known MatchedBlockName values. + * + * @return known MatchedBlockName values. + */ + public static Collection values() { + return values(MatchedBlockName.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnFailure.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnFailure.java new file mode 100644 index 000000000000..eb9692b81344 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnFailure.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.storageactions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Action to be taken when the operation fails for a object. + */ +public enum OnFailure { + /** + * Enum value break. + */ + BREAK("break"); + + /** + * The actual serialized value for a OnFailure instance. + */ + private final String value; + + OnFailure(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnFailure instance. + * + * @param value the serialized value to parse. + * @return the parsed OnFailure object, or null if unable to parse. + */ + @JsonCreator + public static OnFailure fromString(String value) { + if (value == null) { + return null; + } + OnFailure[] items = OnFailure.values(); + for (OnFailure item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnSuccess.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnSuccess.java new file mode 100644 index 000000000000..4b618d23ea42 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OnSuccess.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.storageactions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Action to be taken when the operation is successful for a object. + */ +public enum OnSuccess { + /** + * Enum value continue. + */ + CONTINUE("continue"); + + /** + * The actual serialized value for a OnSuccess instance. + */ + private final String value; + + OnSuccess(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnSuccess instance. + * + * @param value the serialized value to parse. + * @return the parsed OnSuccess object, or null if unable to parse. + */ + @JsonCreator + public static OnSuccess fromString(String value) { + if (value == null) { + return null; + } + OnSuccess[] items = OnSuccess.values(); + for (OnSuccess item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operation.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operation.java new file mode 100644 index 000000000000..6466484007ce --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operation.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.storageactions.models; + +import com.azure.resourcemanager.storageactions.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.storageactions.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationDisplay.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationDisplay.java new file mode 100644 index 000000000000..d47e35ef4b9c --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationDisplay.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.storageactions.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; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationListResult.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationListResult.java new file mode 100644 index 000000000000..09ade72575cc --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/OperationListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storageactions.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; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operations.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operations.java new file mode 100644 index 000000000000..4d166f077ba7 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Operations.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.storageactions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * Lists all of the available Storage Actions Rest API operations. + * + * @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 of the available Storage Actions Rest API operations. + * + * @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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Origin.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Origin.java new file mode 100644 index 000000000000..e483681b4c67 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/Origin.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +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 a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ProvisioningState.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ProvisioningState.java new file mode 100644 index 000000000000..a85d88f2bae2 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/ProvisioningState.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Represents the provisioning state of the storage task. + */ +public enum ProvisioningState { + /** + * Enum value ValidateSubscriptionQuotaBegin. + */ + VALIDATE_SUBSCRIPTION_QUOTA_BEGIN("ValidateSubscriptionQuotaBegin"), + + /** + * Enum value ValidateSubscriptionQuotaEnd. + */ + VALIDATE_SUBSCRIPTION_QUOTA_END("ValidateSubscriptionQuotaEnd"), + + /** + * Enum value Creating. + */ + CREATING("Creating"), + + /** + * Enum value Succeeded. + */ + SUCCEEDED("Succeeded"), + + /** + * Enum value Deleting. + */ + DELETING("Deleting"), + + /** + * Enum value Canceled. + */ + CANCELED("Canceled"), + + /** + * Enum value Failed. + */ + FAILED("Failed"); + + /** + * The actual serialized value for a ProvisioningState instance. + */ + private final String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + if (value == null) { + return null; + } + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunResult.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunResult.java new file mode 100644 index 000000000000..e13b1588535b --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunResult.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Represents the overall result of the execution for the run instance. + */ +public final class RunResult extends ExpandableStringEnum { + /** + * Static value Succeeded for RunResult. + */ + public static final RunResult SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for RunResult. + */ + public static final RunResult FAILED = fromString("Failed"); + + /** + * Creates a new instance of RunResult value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RunResult() { + } + + /** + * Creates or finds a RunResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunResult. + */ + @JsonCreator + public static RunResult fromString(String name) { + return fromString(name, RunResult.class); + } + + /** + * Gets known RunResult values. + * + * @return known RunResult values. + */ + public static Collection values() { + return values(RunResult.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunStatusEnum.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunStatusEnum.java new file mode 100644 index 000000000000..608091f2d635 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/RunStatusEnum.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Represents the status of the execution. + */ +public final class RunStatusEnum extends ExpandableStringEnum { + /** + * Static value InProgress for RunStatusEnum. + */ + public static final RunStatusEnum IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Finished for RunStatusEnum. + */ + public static final RunStatusEnum FINISHED = fromString("Finished"); + + /** + * Creates a new instance of RunStatusEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RunStatusEnum() { + } + + /** + * Creates or finds a RunStatusEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStatusEnum. + */ + @JsonCreator + public static RunStatusEnum fromString(String name) { + return fromString(name, RunStatusEnum.class); + } + + /** + * Gets known RunStatusEnum values. + * + * @return known RunStatusEnum values. + */ + public static Collection values() { + return values(RunStatusEnum.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTask.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTask.java new file mode 100644 index 000000000000..bb98ddc311bf --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTask.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner; +import java.util.Map; + +/** + * An immutable client-side representation of StorageTask. + */ +public interface StorageTask { + /** + * 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 identity property: The managed service identity of the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the properties property: Properties of the storage task. + * + * @return the properties value. + */ + StorageTaskProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.storageactions.fluent.models.StorageTaskInner object. + * + * @return the inner object. + */ + StorageTaskInner innerModel(); + + /** + * The entirety of the StorageTask definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The StorageTask definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the StorageTask definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the StorageTask 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 StorageTask 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 StorageTask 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.WithIdentity, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageTask create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageTask create(Context context); + } + + /** + * The stage of the StorageTask 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 StorageTask definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identity of the resource.. + * + * @param identity The managed service identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the StorageTask definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the storage task.. + * + * @param properties Properties of the storage task. + * @return the next definition stage. + */ + WithCreate withProperties(StorageTaskProperties properties); + } + } + + /** + * Begins update for the StorageTask resource. + * + * @return the stage of resource update. + */ + StorageTask.Update update(); + + /** + * The template for StorageTask update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageTask apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageTask apply(Context context); + } + + /** + * The StorageTask update stages. + */ + interface UpdateStages { + /** + * The stage of the StorageTask update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Gets or sets a list of key value pairs that describe the resource. These + * tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can + * be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value + * no greater in length than 256 characters.. + * + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a + * resource. Each tag must have a key no greater in length than 128 characters and a value no greater in + * length than 256 characters. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the StorageTask update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the StorageTask update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the storage task.. + * + * @param properties Properties of the storage task. + * @return the next definition stage. + */ + Update withProperties(StorageTaskProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageTask refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageTask refresh(Context context); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAction.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAction.java new file mode 100644 index 000000000000..9e38d0608b2f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAction.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The storage task action represents conditional statements and operations to be performed on target objects. + */ +@Fluent +public final class StorageTaskAction { + /* + * The if block of storage task operation + */ + @JsonProperty(value = "if", required = true) + private IfCondition ifProperty; + + /* + * The else block of storage task operation + */ + @JsonProperty(value = "else") + private ElseCondition elseProperty; + + /** + * Creates an instance of StorageTaskAction class. + */ + public StorageTaskAction() { + } + + /** + * Get the ifProperty property: The if block of storage task operation. + * + * @return the ifProperty value. + */ + public IfCondition ifProperty() { + return this.ifProperty; + } + + /** + * Set the ifProperty property: The if block of storage task operation. + * + * @param ifProperty the ifProperty value to set. + * @return the StorageTaskAction object itself. + */ + public StorageTaskAction withIfProperty(IfCondition ifProperty) { + this.ifProperty = ifProperty; + return this; + } + + /** + * Get the elseProperty property: The else block of storage task operation. + * + * @return the elseProperty value. + */ + public ElseCondition elseProperty() { + return this.elseProperty; + } + + /** + * Set the elseProperty property: The else block of storage task operation. + * + * @param elseProperty the elseProperty value to set. + * @return the StorageTaskAction object itself. + */ + public StorageTaskAction withElseProperty(ElseCondition elseProperty) { + this.elseProperty = elseProperty; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ifProperty() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property ifProperty in model StorageTaskAction")); + } else { + ifProperty().validate(); + } + if (elseProperty() != null) { + elseProperty().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskAction.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignment.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignment.java new file mode 100644 index 000000000000..e3d0222bbe03 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignment.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner; + +/** + * An immutable client-side representation of StorageTaskAssignment. + */ +public interface StorageTaskAssignment { + /** + * Gets the id property: ARM Id of the storage task assignments, associated with the storage tasks. + * + * @return the id value. + */ + String id(); + + /** + * Gets the inner com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner object. + * + * @return the inner object. + */ + StorageTaskAssignmentInner innerModel(); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignments.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignments.java new file mode 100644 index 000000000000..8f3f3c0f37af --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignments.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of StorageTaskAssignments. + */ +public interface StorageTaskAssignments { + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageTaskName); + + /** + * Lists all the storage tasks available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @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 response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageTaskName, String maxpagesize, + Context context); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignmentsListResult.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignmentsListResult.java new file mode 100644 index 000000000000..9b57951dfc87 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskAssignmentsListResult.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response from the List Storage Tasks operation. + */ +@Immutable +public final class StorageTaskAssignmentsListResult { + /* + * Gets the list of storage task assignment Ids. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of storage task assignment Ids. Returned when total number of + * requested storage task assignment Ids exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of StorageTaskAssignmentsListResult class. + */ + public StorageTaskAssignmentsListResult() { + } + + /** + * Get the value property: Gets the list of storage task assignment Ids. + * + * @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 storage task assignment Ids. + * Returned when total number of requested storage task assignment Ids 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperation.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperation.java new file mode 100644 index 000000000000..ade8765e6246 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperation.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.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Represents an operation to be performed on the object. + */ +@Fluent +public final class StorageTaskOperation { + /* + * The operation to be performed on the object. + */ + @JsonProperty(value = "name", required = true) + private StorageTaskOperationName name; + + /* + * Key-value parameters for the operation. + */ + @JsonProperty(value = "parameters") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map parameters; + + /* + * Action to be taken when the operation is successful for a object. + */ + @JsonProperty(value = "onSuccess") + private OnSuccess onSuccess; + + /* + * Action to be taken when the operation fails for a object. + */ + @JsonProperty(value = "onFailure") + private OnFailure onFailure; + + /** + * Creates an instance of StorageTaskOperation class. + */ + public StorageTaskOperation() { + } + + /** + * Get the name property: The operation to be performed on the object. + * + * @return the name value. + */ + public StorageTaskOperationName name() { + return this.name; + } + + /** + * Set the name property: The operation to be performed on the object. + * + * @param name the name value to set. + * @return the StorageTaskOperation object itself. + */ + public StorageTaskOperation withName(StorageTaskOperationName name) { + this.name = name; + return this; + } + + /** + * Get the parameters property: Key-value parameters for the operation. + * + * @return the parameters value. + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Key-value parameters for the operation. + * + * @param parameters the parameters value to set. + * @return the StorageTaskOperation object itself. + */ + public StorageTaskOperation withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the onSuccess property: Action to be taken when the operation is successful for a object. + * + * @return the onSuccess value. + */ + public OnSuccess onSuccess() { + return this.onSuccess; + } + + /** + * Set the onSuccess property: Action to be taken when the operation is successful for a object. + * + * @param onSuccess the onSuccess value to set. + * @return the StorageTaskOperation object itself. + */ + public StorageTaskOperation withOnSuccess(OnSuccess onSuccess) { + this.onSuccess = onSuccess; + return this; + } + + /** + * Get the onFailure property: Action to be taken when the operation fails for a object. + * + * @return the onFailure value. + */ + public OnFailure onFailure() { + return this.onFailure; + } + + /** + * Set the onFailure property: Action to be taken when the operation fails for a object. + * + * @param onFailure the onFailure value to set. + * @return the StorageTaskOperation object itself. + */ + public StorageTaskOperation withOnFailure(OnFailure onFailure) { + this.onFailure = onFailure; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property name in model StorageTaskOperation")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskOperation.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperationName.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperationName.java new file mode 100644 index 000000000000..9f858273dcfc --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskOperationName.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The operation to be performed on the object. + */ +public final class StorageTaskOperationName extends ExpandableStringEnum { + /** + * Static value SetBlobTier for StorageTaskOperationName. + */ + public static final StorageTaskOperationName SET_BLOB_TIER = fromString("SetBlobTier"); + + /** + * Static value SetBlobTags for StorageTaskOperationName. + */ + public static final StorageTaskOperationName SET_BLOB_TAGS = fromString("SetBlobTags"); + + /** + * Static value SetBlobImmutabilityPolicy for StorageTaskOperationName. + */ + public static final StorageTaskOperationName SET_BLOB_IMMUTABILITY_POLICY = fromString("SetBlobImmutabilityPolicy"); + + /** + * Static value SetBlobLegalHold for StorageTaskOperationName. + */ + public static final StorageTaskOperationName SET_BLOB_LEGAL_HOLD = fromString("SetBlobLegalHold"); + + /** + * Static value SetBlobExpiry for StorageTaskOperationName. + */ + public static final StorageTaskOperationName SET_BLOB_EXPIRY = fromString("SetBlobExpiry"); + + /** + * Static value DeleteBlob for StorageTaskOperationName. + */ + public static final StorageTaskOperationName DELETE_BLOB = fromString("DeleteBlob"); + + /** + * Static value UndeleteBlob for StorageTaskOperationName. + */ + public static final StorageTaskOperationName UNDELETE_BLOB = fromString("UndeleteBlob"); + + /** + * Creates a new instance of StorageTaskOperationName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageTaskOperationName() { + } + + /** + * Creates or finds a StorageTaskOperationName from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageTaskOperationName. + */ + @JsonCreator + public static StorageTaskOperationName fromString(String name) { + return fromString(name, StorageTaskOperationName.class); + } + + /** + * Gets known StorageTaskOperationName values. + * + * @return known StorageTaskOperationName values. + */ + public static Collection values() { + return values(StorageTaskOperationName.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewAction.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewAction.java new file mode 100644 index 000000000000..c085d1ce99a7 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewAction.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; + +/** + * An immutable client-side representation of StorageTaskPreviewAction. + */ +public interface StorageTaskPreviewAction { + /** + * Gets the properties property: Properties of the storage task preview. + * + * @return the properties value. + */ + StorageTaskPreviewActionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner object. + * + * @return the inner object. + */ + StorageTaskPreviewActionInner innerModel(); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionCondition.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionCondition.java new file mode 100644 index 000000000000..c24a0c0e8a93 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionCondition.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.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the storage task conditions to be tested for a match with container and blob properties. + */ +@Fluent +public final class StorageTaskPreviewActionCondition { + /* + * The condition to be tested for a match with container and blob properties. + */ + @JsonProperty(value = "if", required = true) + private StorageTaskPreviewActionIfCondition ifProperty; + + /* + * Specify whether the else block is present in the condition. + */ + @JsonProperty(value = "elseBlockExists", required = true) + private boolean elseBlockExists; + + /** + * Creates an instance of StorageTaskPreviewActionCondition class. + */ + public StorageTaskPreviewActionCondition() { + } + + /** + * Get the ifProperty property: The condition to be tested for a match with container and blob properties. + * + * @return the ifProperty value. + */ + public StorageTaskPreviewActionIfCondition ifProperty() { + return this.ifProperty; + } + + /** + * Set the ifProperty property: The condition to be tested for a match with container and blob properties. + * + * @param ifProperty the ifProperty value to set. + * @return the StorageTaskPreviewActionCondition object itself. + */ + public StorageTaskPreviewActionCondition withIfProperty(StorageTaskPreviewActionIfCondition ifProperty) { + this.ifProperty = ifProperty; + return this; + } + + /** + * Get the elseBlockExists property: Specify whether the else block is present in the condition. + * + * @return the elseBlockExists value. + */ + public boolean elseBlockExists() { + return this.elseBlockExists; + } + + /** + * Set the elseBlockExists property: Specify whether the else block is present in the condition. + * + * @param elseBlockExists the elseBlockExists value to set. + * @return the StorageTaskPreviewActionCondition object itself. + */ + public StorageTaskPreviewActionCondition withElseBlockExists(boolean elseBlockExists) { + this.elseBlockExists = elseBlockExists; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ifProperty() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property ifProperty in model StorageTaskPreviewActionCondition")); + } else { + ifProperty().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskPreviewActionCondition.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionIfCondition.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionIfCondition.java new file mode 100644 index 000000000000..52afc654fb61 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionIfCondition.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents storage task preview action condition. + */ +@Fluent +public final class StorageTaskPreviewActionIfCondition { + /* + * Storage task condition to bes tested for a match. + */ + @JsonProperty(value = "condition") + private String condition; + + /** + * Creates an instance of StorageTaskPreviewActionIfCondition class. + */ + public StorageTaskPreviewActionIfCondition() { + } + + /** + * Get the condition property: Storage task condition to bes tested for a match. + * + * @return the condition value. + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition property: Storage task condition to bes tested for a match. + * + * @param condition the condition value to set. + * @return the StorageTaskPreviewActionIfCondition object itself. + */ + public StorageTaskPreviewActionIfCondition withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionProperties.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionProperties.java new file mode 100644 index 000000000000..65d29098cb04 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewActionProperties.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Storage task preview action properties. + */ +@Fluent +public final class StorageTaskPreviewActionProperties { + /* + * Preview action container properties to be tested for a match with the provided condition. + */ + @JsonProperty(value = "container", required = true) + private StorageTaskPreviewContainerProperties container; + + /* + * Preview action container properties to be tested for a match with the provided condition. + */ + @JsonProperty(value = "blobs", required = true) + private List blobs; + + /* + * Preview action container properties to be tested for a match with the provided condition. + */ + @JsonProperty(value = "action", required = true) + private StorageTaskPreviewActionCondition action; + + /** + * Creates an instance of StorageTaskPreviewActionProperties class. + */ + public StorageTaskPreviewActionProperties() { + } + + /** + * Get the container property: Preview action container properties to be tested for a match with the provided + * condition. + * + * @return the container value. + */ + public StorageTaskPreviewContainerProperties container() { + return this.container; + } + + /** + * Set the container property: Preview action container properties to be tested for a match with the provided + * condition. + * + * @param container the container value to set. + * @return the StorageTaskPreviewActionProperties object itself. + */ + public StorageTaskPreviewActionProperties withContainer(StorageTaskPreviewContainerProperties container) { + this.container = container; + return this; + } + + /** + * Get the blobs property: Preview action container properties to be tested for a match with the provided + * condition. + * + * @return the blobs value. + */ + public List blobs() { + return this.blobs; + } + + /** + * Set the blobs property: Preview action container properties to be tested for a match with the provided + * condition. + * + * @param blobs the blobs value to set. + * @return the StorageTaskPreviewActionProperties object itself. + */ + public StorageTaskPreviewActionProperties withBlobs(List blobs) { + this.blobs = blobs; + return this; + } + + /** + * Get the action property: Preview action container properties to be tested for a match with the provided + * condition. + * + * @return the action value. + */ + public StorageTaskPreviewActionCondition action() { + return this.action; + } + + /** + * Set the action property: Preview action container properties to be tested for a match with the provided + * condition. + * + * @param action the action value to set. + * @return the StorageTaskPreviewActionProperties object itself. + */ + public StorageTaskPreviewActionProperties withAction(StorageTaskPreviewActionCondition action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (container() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property container in model StorageTaskPreviewActionProperties")); + } else { + container().validate(); + } + if (blobs() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property blobs in model StorageTaskPreviewActionProperties")); + } else { + blobs().forEach(e -> e.validate()); + } + if (action() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property action in model StorageTaskPreviewActionProperties")); + } else { + action().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskPreviewActionProperties.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewBlobProperties.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewBlobProperties.java new file mode 100644 index 000000000000..e669ae71b386 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewBlobProperties.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.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Storage task preview container properties. + */ +@Fluent +public final class StorageTaskPreviewBlobProperties { + /* + * property for the container name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * properties key value pairs to be tested for a match against the provided condition. + */ + @JsonProperty(value = "properties") + private List properties; + + /* + * metadata key value pairs to be tested for a match against the provided condition. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /* + * tags key value pairs to be tested for a match against the provided condition. + */ + @JsonProperty(value = "tags") + private List tags; + + /* + * Represents the condition block name that matched blob properties. + */ + @JsonProperty(value = "matchedBlock", access = JsonProperty.Access.WRITE_ONLY) + private MatchedBlockName matchedBlock; + + /** + * Creates an instance of StorageTaskPreviewBlobProperties class. + */ + public StorageTaskPreviewBlobProperties() { + } + + /** + * Get the name property: property for the container name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: property for the container name. + * + * @param name the name value to set. + * @return the StorageTaskPreviewBlobProperties object itself. + */ + public StorageTaskPreviewBlobProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: properties key value pairs to be tested for a match against the provided condition. + * + * @return the properties value. + */ + public List properties() { + return this.properties; + } + + /** + * Set the properties property: properties key value pairs to be tested for a match against the provided condition. + * + * @param properties the properties value to set. + * @return the StorageTaskPreviewBlobProperties object itself. + */ + public StorageTaskPreviewBlobProperties withProperties(List properties) { + this.properties = properties; + return this; + } + + /** + * Get the metadata property: metadata key value pairs to be tested for a match against the provided condition. + * + * @return the metadata value. + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the metadata property: metadata key value pairs to be tested for a match against the provided condition. + * + * @param metadata the metadata value to set. + * @return the StorageTaskPreviewBlobProperties object itself. + */ + public StorageTaskPreviewBlobProperties withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the tags property: tags key value pairs to be tested for a match against the provided condition. + * + * @return the tags value. + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags property: tags key value pairs to be tested for a match against the provided condition. + * + * @param tags the tags value to set. + * @return the StorageTaskPreviewBlobProperties object itself. + */ + public StorageTaskPreviewBlobProperties withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Get the matchedBlock property: Represents the condition block name that matched blob properties. + * + * @return the matchedBlock value. + */ + public MatchedBlockName matchedBlock() { + return this.matchedBlock; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().forEach(e -> e.validate()); + } + if (metadata() != null) { + metadata().forEach(e -> e.validate()); + } + if (tags() != null) { + tags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewContainerProperties.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewContainerProperties.java new file mode 100644 index 000000000000..e413c4ce65f5 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewContainerProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Storage task preview container properties. + */ +@Fluent +public final class StorageTaskPreviewContainerProperties { + /* + * property for the container name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * metadata key value pairs to be tested for a match against the provided condition. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Creates an instance of StorageTaskPreviewContainerProperties class. + */ + public StorageTaskPreviewContainerProperties() { + } + + /** + * Get the name property: property for the container name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: property for the container name. + * + * @param name the name value to set. + * @return the StorageTaskPreviewContainerProperties object itself. + */ + public StorageTaskPreviewContainerProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the metadata property: metadata key value pairs to be tested for a match against the provided condition. + * + * @return the metadata value. + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the metadata property: metadata key value pairs to be tested for a match against the provided condition. + * + * @param metadata the metadata value to set. + * @return the StorageTaskPreviewContainerProperties object itself. + */ + public StorageTaskPreviewContainerProperties withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewKeyValueProperties.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewKeyValueProperties.java new file mode 100644 index 000000000000..fdd3ed87e825 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskPreviewKeyValueProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage task preview object key value pair properties. + */ +@Fluent +public final class StorageTaskPreviewKeyValueProperties { + /* + * Represents the key property of the pair. + */ + @JsonProperty(value = "key") + private String key; + + /* + * Represents the value property of the pair. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Creates an instance of StorageTaskPreviewKeyValueProperties class. + */ + public StorageTaskPreviewKeyValueProperties() { + } + + /** + * Get the key property: Represents the key property of the pair. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: Represents the key property of the pair. + * + * @param key the key value to set. + * @return the StorageTaskPreviewKeyValueProperties object itself. + */ + public StorageTaskPreviewKeyValueProperties withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: Represents the value property of the pair. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Represents the value property of the pair. + * + * @param value the value value to set. + * @return the StorageTaskPreviewKeyValueProperties object itself. + */ + public StorageTaskPreviewKeyValueProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskProperties.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskProperties.java new file mode 100644 index 000000000000..915a4097a95a --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskProperties.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.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** + * Properties of the storage task. + */ +@Fluent +public final class StorageTaskProperties { + /* + * Storage task version. + */ + @JsonProperty(value = "taskVersion", access = JsonProperty.Access.WRITE_ONLY) + private Long taskVersion; + + /* + * Storage Task is enabled when set to true and disabled when set to false + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * Text that describes the purpose of the storage task + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The storage task action that is executed + */ + @JsonProperty(value = "action", required = true) + private StorageTaskAction action; + + /* + * Represents the provisioning state of the storage task. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The creation date and time of the storage task in UTC. + */ + @JsonProperty(value = "creationTimeInUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTimeInUtc; + + /** + * Creates an instance of StorageTaskProperties class. + */ + public StorageTaskProperties() { + } + + /** + * Get the taskVersion property: Storage task version. + * + * @return the taskVersion value. + */ + public Long taskVersion() { + return this.taskVersion; + } + + /** + * Get the enabled property: Storage Task is enabled when set to true and disabled when set to false. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Storage Task is enabled when set to true and disabled when set to false. + * + * @param enabled the enabled value to set. + * @return the StorageTaskProperties object itself. + */ + public StorageTaskProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the description property: Text that describes the purpose of the storage task. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Text that describes the purpose of the storage task. + * + * @param description the description value to set. + * @return the StorageTaskProperties object itself. + */ + public StorageTaskProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action property: The storage task action that is executed. + * + * @return the action value. + */ + public StorageTaskAction action() { + return this.action; + } + + /** + * Set the action property: The storage task action that is executed. + * + * @param action the action value to set. + * @return the StorageTaskProperties object itself. + */ + public StorageTaskProperties withAction(StorageTaskAction action) { + this.action = action; + return this; + } + + /** + * Get the provisioningState property: Represents the provisioning state of the storage task. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the creationTimeInUtc property: The creation date and time of the storage task in UTC. + * + * @return the creationTimeInUtc value. + */ + public OffsetDateTime creationTimeInUtc() { + return this.creationTimeInUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (description() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property description in model StorageTaskProperties")); + } + if (action() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property action in model StorageTaskProperties")); + } else { + action().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageTaskProperties.class); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportInstance.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportInstance.java new file mode 100644 index 000000000000..c59762ee7555 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportInstance.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner; + +/** + * An immutable client-side representation of StorageTaskReportInstance. + */ +public interface StorageTaskReportInstance { + /** + * 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: Storage task execution report for a run instance. + * + * @return the properties value. + */ + StorageTaskReportProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner object. + * + * @return the inner object. + */ + StorageTaskReportInstanceInner innerModel(); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportProperties.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportProperties.java new file mode 100644 index 000000000000..683a6ea0d503 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportProperties.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage task execution report for a run instance. + */ +@Immutable +public final class StorageTaskReportProperties { + /* + * Represents the Storage Task Assignment Id associated with the storage task that provided an execution context. + */ + @JsonProperty(value = "taskAssignmentId", access = JsonProperty.Access.WRITE_ONLY) + private String taskAssignmentId; + + /* + * Represents the Storage Account Id where the storage task definition was applied and executed. + */ + @JsonProperty(value = "storageAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String storageAccountId; + + /* + * Start time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other + * comparison operators can be used as described for DateTime properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison- + * operators + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private String startTime; + + /* + * End time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other + * comparison operators can be used as described for DateTime properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison- + * operators + */ + @JsonProperty(value = "finishTime", access = JsonProperty.Access.WRITE_ONLY) + private String finishTime; + + /* + * Total number of objects that meet the condition as defined in the storage task assignment execution context. + * Filter options such as objectsTargetedCount gt 50 and other comparison operators can be used as described for + * Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison- + * operators + */ + @JsonProperty(value = "objectsTargetedCount", access = JsonProperty.Access.WRITE_ONLY) + private String objectsTargetedCount; + + /* + * Total number of objects that meet the storage tasks condition and were operated upon. Filter options such as + * objectsOperatedOnCount ge 100 and other comparison operators can be used as described for Numerical properties + * in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison- + * operators + */ + @JsonProperty(value = "objectsOperatedOnCount", access = JsonProperty.Access.WRITE_ONLY) + private String objectsOperatedOnCount; + + /* + * Total number of objects where task operation failed when was attempted. Filter options such as objectFailedCount + * eq 0 and other comparison operators can be used as described for Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison- + * operators + */ + @JsonProperty(value = "objectFailedCount", access = JsonProperty.Access.WRITE_ONLY) + private String objectFailedCount; + + /* + * Total number of objects where task operation succeeded when was attempted.Filter options such as + * objectsSucceededCount gt 150 and other comparison operators can be used as described for Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison- + * operators + */ + @JsonProperty(value = "objectsSucceededCount", access = JsonProperty.Access.WRITE_ONLY) + private String objectsSucceededCount; + + /* + * Well known Azure Storage error code that represents the error encountered during execution of the run instance. + */ + @JsonProperty(value = "runStatusError", access = JsonProperty.Access.WRITE_ONLY) + private String runStatusError; + + /* + * Represents the status of the execution. + */ + @JsonProperty(value = "runStatusEnum", access = JsonProperty.Access.WRITE_ONLY) + private RunStatusEnum runStatusEnum; + + /* + * Full path to the verbose report stored in the reporting container as specified in the assignment execution + * context for the storage account. + */ + @JsonProperty(value = "summaryReportPath", access = JsonProperty.Access.WRITE_ONLY) + private String summaryReportPath; + + /* + * Storage Task Arm Id. + */ + @JsonProperty(value = "taskId", access = JsonProperty.Access.WRITE_ONLY) + private String taskId; + + /* + * Storage Task Version + */ + @JsonProperty(value = "taskVersion", access = JsonProperty.Access.WRITE_ONLY) + private String taskVersion; + + /* + * Represents the overall result of the execution for the run instance + */ + @JsonProperty(value = "runResult", access = JsonProperty.Access.WRITE_ONLY) + private RunResult runResult; + + /** + * Creates an instance of StorageTaskReportProperties class. + */ + public StorageTaskReportProperties() { + } + + /** + * Get the taskAssignmentId property: Represents the Storage Task Assignment Id associated with the storage task + * that provided an execution context. + * + * @return the taskAssignmentId value. + */ + public String taskAssignmentId() { + return this.taskAssignmentId; + } + + /** + * Get the storageAccountId property: Represents the Storage Account Id where the storage task definition was + * applied and executed. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Get the startTime property: Start time of the run instance. Filter options such as startTime gt + * '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties + * in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Get the finishTime property: End time of the run instance. Filter options such as startTime gt + * '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties + * in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + * + * @return the finishTime value. + */ + public String finishTime() { + return this.finishTime; + } + + /** + * Get the objectsTargetedCount property: Total number of objects that meet the condition as defined in the storage + * task assignment execution context. Filter options such as objectsTargetedCount gt 50 and other comparison + * operators can be used as described for Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + * + * @return the objectsTargetedCount value. + */ + public String objectsTargetedCount() { + return this.objectsTargetedCount; + } + + /** + * Get the objectsOperatedOnCount property: Total number of objects that meet the storage tasks condition and were + * operated upon. Filter options such as objectsOperatedOnCount ge 100 and other comparison operators can be used + * as described for Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + * + * @return the objectsOperatedOnCount value. + */ + public String objectsOperatedOnCount() { + return this.objectsOperatedOnCount; + } + + /** + * Get the objectFailedCount property: Total number of objects where task operation failed when was attempted. + * Filter options such as objectFailedCount eq 0 and other comparison operators can be used as described for + * Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + * + * @return the objectFailedCount value. + */ + public String objectFailedCount() { + return this.objectFailedCount; + } + + /** + * Get the objectsSucceededCount property: Total number of objects where task operation succeeded when was + * attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators can be used as + * described for Numerical properties in + * https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + * + * @return the objectsSucceededCount value. + */ + public String objectsSucceededCount() { + return this.objectsSucceededCount; + } + + /** + * Get the runStatusError property: Well known Azure Storage error code that represents the error encountered + * during execution of the run instance. + * + * @return the runStatusError value. + */ + public String runStatusError() { + return this.runStatusError; + } + + /** + * Get the runStatusEnum property: Represents the status of the execution. + * + * @return the runStatusEnum value. + */ + public RunStatusEnum runStatusEnum() { + return this.runStatusEnum; + } + + /** + * Get the summaryReportPath property: Full path to the verbose report stored in the reporting container as + * specified in the assignment execution context for the storage account. + * + * @return the summaryReportPath value. + */ + public String summaryReportPath() { + return this.summaryReportPath; + } + + /** + * Get the taskId property: Storage Task Arm Id. + * + * @return the taskId value. + */ + public String taskId() { + return this.taskId; + } + + /** + * Get the taskVersion property: Storage Task Version. + * + * @return the taskVersion value. + */ + public String taskVersion() { + return this.taskVersion; + } + + /** + * Get the runResult property: Represents the overall result of the execution for the run instance. + * + * @return the runResult value. + */ + public RunResult runResult() { + return this.runResult; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportSummary.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportSummary.java new file mode 100644 index 000000000000..594f2dc634f4 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskReportSummary.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Fetch Storage Tasks Run Summary. + */ +@Immutable +public final class StorageTaskReportSummary { + /* + * Gets storage tasks run result summary. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of storage task run results summary. Returned when the number of + * run instances and summary reports exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of StorageTaskReportSummary class. + */ + public StorageTaskReportSummary() { + } + + /** + * Get the value property: Gets storage tasks run result summary. + * + * @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 storage task run results summary. + * Returned when the number of run instances and summary reports 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskUpdateParameters.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskUpdateParameters.java new file mode 100644 index 000000000000..a0af1f1feea0 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTaskUpdateParameters.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Parameters of the storage task update request. + */ +@Fluent +public final class StorageTaskUpdateParameters { + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and + * grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag + * must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Properties of the storage task. + */ + @JsonProperty(value = "properties") + private StorageTaskProperties properties; + + /** + * Creates an instance of StorageTaskUpdateParameters class. + */ + public StorageTaskUpdateParameters() { + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the StorageTaskUpdateParameters object itself. + */ + public StorageTaskUpdateParameters withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Gets or sets a list of key value pairs that describe the resource. These tags can be used + * in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a + * resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length + * than 256 characters. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Gets or sets a list of key value pairs that describe the resource. These tags can be used + * in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a + * resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length + * than 256 characters. + * + * @param tags the tags value to set. + * @return the StorageTaskUpdateParameters object itself. + */ + public StorageTaskUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Properties of the storage task. + * + * @return the properties value. + */ + public StorageTaskProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the storage task. + * + * @param properties the properties value to set. + * @return the StorageTaskUpdateParameters object itself. + */ + public StorageTaskUpdateParameters withProperties(StorageTaskProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasks.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasks.java new file mode 100644 index 000000000000..143111d97f8a --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasks.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; + +/** + * Resource collection API of StorageTasks. + */ +public interface StorageTasks { + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName); + + /** + * Delete the storage task resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 storageTaskName, Context context); + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String storageTaskName, + Context context); + + /** + * Get the storage task properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 task properties. + */ + StorageTask getByResourceGroup(String resourceGroupName, String storageTaskName); + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the storage tasks available under the 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the storage tasks available under the given 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 the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action along with {@link Response}. + */ + Response previewActionsWithResponse(String location, + StorageTaskPreviewActionInner parameters, Context context); + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in response. + * + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @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 storage Task Preview Action. + */ + StorageTaskPreviewAction previewActions(String location, StorageTaskPreviewActionInner parameters); + + /** + * Get the storage task properties. + * + * @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 the storage task properties along with {@link Response}. + */ + StorageTask getById(String id); + + /** + * Get the storage task properties. + * + * @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 the storage task properties along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the storage task 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); + + /** + * Delete the storage task 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 StorageTask resource. + * + * @param name resource name. + * @return the first stage of the new StorageTask definition. + */ + StorageTask.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksListResult.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksListResult.java new file mode 100644 index 000000000000..dbc42b211788 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksListResult.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response from the List Storage Tasks operation. + */ +@Immutable +public final class StorageTasksListResult { + /* + * Gets the list of storage tasks and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of storage tasks. Returned when total number of requested + * storage tasks exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of StorageTasksListResult class. + */ + public StorageTasksListResult() { + } + + /** + * Get the value property: Gets the list of storage tasks and their properties. + * + * @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 storage tasks. Returned when total + * number of requested storage tasks 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/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksReports.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksReports.java new file mode 100644 index 000000000000..7437490733fd --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/StorageTasksReports.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of StorageTasksReports. + */ +public interface StorageTasksReports { + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageTaskName); + + /** + * Fetch the storage tasks run report summary for each assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage task names must + * be between 3 and 18 characters in length and use numbers and lower-case letters only. + * @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the + * list response. + * @param filter Optional. When specified, it can be used to query using reporting properties. + * @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 fetch Storage Tasks Run Summary as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String storageTaskName, String maxpagesize, + String filter, Context context); +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/UserAssignedIdentity.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..e0dd3e69d269 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/UserAssignedIdentity.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/package-info.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/package-info.java new file mode 100644 index 000000000000..8ebe8db8ef6a --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/models/package-info.java @@ -0,0 +1,9 @@ +// 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 StorageActionsMgmtClient. + * The Azure Storage Actions Management API. + */ +package com.azure.resourcemanager.storageactions.models; diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/package-info.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/package-info.java new file mode 100644 index 000000000000..307bd3453167 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/com/azure/resourcemanager/storageactions/package-info.java @@ -0,0 +1,9 @@ +// 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 StorageActionsMgmtClient. + * The Azure Storage Actions Management API. + */ +package com.azure.resourcemanager.storageactions; diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/module-info.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/module-info.java new file mode 100644 index 000000000000..65c238b848bb --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.storageactions { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.storageactions; + exports com.azure.resourcemanager.storageactions.fluent; + exports com.azure.resourcemanager.storageactions.fluent.models; + exports com.azure.resourcemanager.storageactions.models; + opens com.azure.resourcemanager.storageactions.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.storageactions.models to com.azure.core, com.fasterxml.jackson.databind; +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/proxy-config.json b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/proxy-config.json new file mode 100644 index 000000000000..ecdbd3f19a42 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.storageactions.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.storageactions.implementation.StorageTasksClientImpl$StorageTasksService" ], [ "com.azure.resourcemanager.storageactions.implementation.StorageTaskAssignmentsClientImpl$StorageTaskAssignmentsService" ], [ "com.azure.resourcemanager.storageactions.implementation.StorageTasksReportsClientImpl$StorageTasksReportsService" ] ] \ No newline at end of file diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/reflect-config.json b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/reflect-config.json new file mode 100644 index 000000000000..23dd66ccfca0 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-storageactions/reflect-config.json @@ -0,0 +1,176 @@ +[ { + "name" : "com.azure.resourcemanager.storageactions.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.UserAssignedIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskAction", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.IfCondition", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskOperation", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.ElseCondition", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskUpdateParameters", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTasksListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskAssignmentsListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskReportSummary", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskReportProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskPreviewContainerProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskPreviewKeyValueProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskPreviewBlobProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionCondition", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionIfCondition", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.StorageTaskOperationName", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.RunStatusEnum", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.RunResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.MatchedBlockName", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.OnFailure", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.storageactions.models.OnSuccess", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/OperationsListSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/OperationsListSamples.java new file mode 100644 index 000000000000..820de9b40e6c --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/OperationsListSamples.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.storageactions.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/ + * OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void operationsList(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentListSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentListSamples.java new file mode 100644 index 000000000000..6b377965535d --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentListSamples.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.storageactions.generated; + +/** + * Samples for StorageTaskAssignment List. + */ +public final class StorageTaskAssignmentListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTaskAssignmentIds.json + */ + /** + * Sample code: ListStorageTaskAssignmentsByResourceGroup. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void listStorageTaskAssignmentsByResourceGroup( + com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTaskAssignments().list("rgroup1", "mytask1", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateSamples.java new file mode 100644 index 000000000000..0a071bb87adc --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateSamples.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.storageactions.generated; + +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageTasks Create. + */ +public final class StorageTasksCreateSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/PutStorageTask.json + */ + /** + * Sample code: PutStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void putStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().define("mytask1").withRegion("westus").withExistingResourceGroup("res4228") + .withProperties(new StorageTaskProperties().withEnabled(true).withDescription("My Storage task") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("[[equals(AccessTier, 'Cool')]]") + .withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("tier", "Hot")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations( + Arrays.asList(new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))))) + .create(); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksDeleteSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksDeleteSamples.java new file mode 100644 index 000000000000..b6e14148befa --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksDeleteSamples.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.storageactions.generated; + +/** + * Samples for StorageTasks Delete. + */ +public final class StorageTasksDeleteSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/DeleteStorageTask.json + */ + /** + * Sample code: DeleteStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void deleteStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().delete("res4228", "mytask1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupSamples.java new file mode 100644 index 000000000000..cf1ef73a4d69 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupSamples.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.storageactions.generated; + +/** + * Samples for StorageTasks GetByResourceGroup. + */ +public final class StorageTasksGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/GetStorageTask.json + */ + /** + * Sample code: GetStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void getStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().getByResourceGroupWithResponse("res4228", "mytask1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupSamples.java new file mode 100644 index 000000000000..98748277e806 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupSamples.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.storageactions.generated; + +/** + * Samples for StorageTasks ListByResourceGroup. + */ +public final class StorageTasksListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTasksByResourceGroup.json + */ + /** + * Sample code: ListStorageTasksByResourceGroup. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + listStorageTasksByResourceGroup(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().listByResourceGroup("res6117", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListSamples.java new file mode 100644 index 000000000000..e64256bddcc0 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListSamples.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.storageactions.generated; + +/** + * Samples for StorageTasks List. + */ +public final class StorageTasksListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTasksBySubscription.json + */ + /** + * Sample code: ListStorageTasksBySubscription. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + listStorageTasksBySubscription(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksPreviewActionsSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksPreviewActionsSamples.java new file mode 100644 index 000000000000..809b6a47a527 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksPreviewActionsSamples.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskPreviewActionInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionCondition; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionIfCondition; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewBlobProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewContainerProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewKeyValueProperties; +import java.util.Arrays; + +/** + * Samples for StorageTasks PreviewActions. + */ +public final class StorageTasksPreviewActionsSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/ + * PerformStorageTaskActionsPreview.json + */ + /** + * Sample code: PerformStorageTaskActionsPreview. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + performStorageTaskActionsPreview(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasks().previewActionsWithResponse("eastus", + new StorageTaskPreviewActionInner().withProperties(new StorageTaskPreviewActionProperties() + .withContainer(new StorageTaskPreviewContainerProperties().withName("firstContainer") + .withMetadata(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("mContainerValue1")))) + .withBlobs(Arrays.asList( + new StorageTaskPreviewBlobProperties().withName("folder1/file1.txt").withProperties(Arrays.asList( + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 07 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 07 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("0x8DB67175454D36D"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("38619"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("text/xml"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("njr6iDrmU9+FC89WMK22EA=="), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue(""), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("BlockBlob"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("Hot"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("true"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("unlocked"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("available"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("true"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder").withValue("1"))) + .withMetadata(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("mValue1"))) + .withTags(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("tValue1"))), + new StorageTaskPreviewBlobProperties().withName("folder2/file1.txt") + .withProperties(Arrays.asList( + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 06 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("Wed, 06 Jun 2023 05:23:29 GMT"), + new StorageTaskPreviewKeyValueProperties().withKey("fakeTokenPlaceholder") + .withValue("0x6FB67175454D36D"))) + .withMetadata(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("mValue2"))) + .withTags(Arrays.asList(new StorageTaskPreviewKeyValueProperties() + .withKey("fakeTokenPlaceholder").withValue("tValue2"))))) + .withAction(new StorageTaskPreviewActionCondition() + .withIfProperty( + new StorageTaskPreviewActionIfCondition().withCondition("[[equals(AccessTier, 'Hot')]]")) + .withElseBlockExists(true))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportListSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportListSamples.java new file mode 100644 index 000000000000..404c20cead31 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportListSamples.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.storageactions.generated; + +/** + * Samples for StorageTasksReport List. + */ +public final class StorageTasksReportListSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksList/ListStorageTasksRunReportSummary.json + */ + /** + * Sample code: ListStorageTasksByResourceGroup. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void + listStorageTasksByResourceGroup(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + manager.storageTasksReports().list("rgroup1", "mytask1", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksUpdateSamples.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksUpdateSamples.java new file mode 100644 index 000000000000..93b56725c270 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/samples/java/com/azure/resourcemanager/storageactions/generated/StorageTasksUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageTasks Update. + */ +public final class StorageTasksUpdateSamples { + /* + * x-ms-original-file: + * specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/ + * storageTasksCrud/PatchStorageTask.json + */ + /** + * Sample code: PatchStorageTask. + * + * @param manager Entry point to StorageActionsManager. + */ + public static void patchStorageTask(com.azure.resourcemanager.storageactions.StorageActionsManager manager) { + StorageTask resource = manager.storageTasks() + .getByResourceGroupWithResponse("res4228", "mytask1", com.azure.core.util.Context.NONE).getValue(); + resource.update() + .withProperties(new StorageTaskProperties().withEnabled(true).withDescription("My Storage task") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("[[equals(AccessTier, 'Cool')]]") + .withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("tier", "Hot")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations( + Arrays.asList(new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))))) + .apply(); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ElseConditionTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ElseConditionTests.java new file mode 100644 index 000000000000..d8a65e226975 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ElseConditionTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ElseConditionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ElseCondition model = BinaryData.fromString( + "{\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"glu\":\"xscpaierhhbc\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}") + .toObject(ElseCondition.class); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, model.operations().get(0).name()); + Assertions.assertEquals("xscpaierhhbc", model.operations().get(0).parameters().get("glu")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.operations().get(0).onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ElseCondition model = new ElseCondition().withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("glu", "xscpaierhhbc")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK))); + model = BinaryData.fromObject(model).toObject(ElseCondition.class); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, model.operations().get(0).name()); + Assertions.assertEquals("xscpaierhhbc", model.operations().get(0).parameters().get("glu")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.operations().get(0).onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/IfConditionTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/IfConditionTests.java new file mode 100644 index 000000000000..9827d7e88b83 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/IfConditionTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IfConditionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IfCondition model = BinaryData.fromString( + "{\"condition\":\"nteiwaopv\",\"operations\":[{\"name\":\"UndeleteBlob\",\"parameters\":{\"uf\":\"mmxdcu\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTier\",\"parameters\":{\"xtbzsgfyccsne\":\"nsez\",\"flnrosfqpteehzz\":\"mdwzjeiachboo\",\"swjdkirso\":\"ypyqrimzinp\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"UndeleteBlob\",\"parameters\":{\"kwh\":\"nohjt\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"DeleteBlob\",\"parameters\":{\"jxvsnbyxqabn\":\"pjxsqwpgrjbznor\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}") + .toObject(IfCondition.class); + Assertions.assertEquals("nteiwaopv", model.condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, model.operations().get(0).name()); + Assertions.assertEquals("mmxdcu", model.operations().get(0).parameters().get("uf")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.operations().get(0).onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IfCondition model = new IfCondition().withCondition("nteiwaopv") + .withOperations(Arrays.asList(new StorageTaskOperation().withName(StorageTaskOperationName.UNDELETE_BLOB) + .withParameters(mapOf("uf", "mmxdcu")).withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER) + .withParameters( + mapOf("xtbzsgfyccsne", "nsez", "flnrosfqpteehzz", "mdwzjeiachboo", "swjdkirso", "ypyqrimzinp")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.UNDELETE_BLOB) + .withParameters(mapOf("kwh", "nohjt")).withOnSuccess(OnSuccess.CONTINUE) + .withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withParameters(mapOf("jxvsnbyxqabn", "pjxsqwpgrjbznor")).withOnSuccess(OnSuccess.CONTINUE) + .withOnFailure(OnFailure.BREAK))); + model = BinaryData.fromObject(model).toObject(IfCondition.class); + Assertions.assertEquals("nteiwaopv", model.condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, model.operations().get(0).name()); + Assertions.assertEquals("mmxdcu", model.operations().get(0).parameters().get("uf")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.operations().get(0).onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ManagedServiceIdentityTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..6c3385fdd86f --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"c7c2252e-661f-461c-b249-8ed6bfc8ea3f\",\"tenantId\":\"7e41176b-a8ab-48ac-87b1-1f9250f19a54\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"e\":{\"principalId\":\"75b05ff5-5ece-4cbf-a936-11d006dda614\",\"clientId\":\"54985df1-3210-423f-a85d-23847133573a\"},\"qjbasvms\":{\"principalId\":\"b471ffbc-1a28-4a9a-847d-812dbede0efe\",\"clientId\":\"0c3b6ea4-faab-4b86-858b-f60192d10283\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("e", new UserAssignedIdentity(), "qjbasvms", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationDisplayTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..866ba919bb88 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationDisplayTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") + .toObject(OperationDisplay.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = new OperationDisplay(); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationInnerTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationInnerTests.java new file mode 100644 index 000000000000..576f41e74879 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationInnerTests.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.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.fluent.models.OperationInner; +import com.azure.resourcemanager.storageactions.models.OperationDisplay; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationListResultTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationListResultTests.java new file mode 100644 index 000000000000..8afd40f84e30 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.OperationListResult; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") + .toObject(OperationListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model = new OperationListResult(); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationsListMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..c2c7327046d7 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/OperationsListMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"name\":\"hashsfwxosow\",\"isDataAction\":true,\"display\":{\"provider\":\"i\",\"resource\":\"ooxdjebwpuc\",\"operation\":\"fvovbvmeuecivy\",\"description\":\"ce\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskActionTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskActionTests.java new file mode 100644 index 000000000000..76636f6a8970 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskActionTests.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.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskActionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskAction model = BinaryData.fromString( + "{\"if\":{\"condition\":\"dmgloug\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"wgcu\":\"mutduqktaps\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]},\"else\":{\"operations\":[{\"name\":\"UndeleteBlob\",\"parameters\":{\"bmdg\":\"qw\",\"dgmb\":\"bjf\",\"tq\":\"bexppb\",\"algbquxigjyjg\":\"rolfpfp\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobExpiry\",\"parameters\":{\"vlejuvfqa\":\"txilnerkujy\",\"xgjvtbv\":\"rlyxwjkcprbnw\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTags\",\"parameters\":{\"guhmuouqfpr\":\"uj\",\"nguitnwuizgazxu\":\"zw\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"UndeleteBlob\",\"parameters\":{\"rfidfvzwdz\":\"i\",\"sdkf\":\"htymw\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}}") + .toObject(StorageTaskAction.class); + Assertions.assertEquals("dmgloug", model.ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, model.ifProperty().operations().get(0).name()); + Assertions.assertEquals("mutduqktaps", model.ifProperty().operations().get(0).parameters().get("wgcu")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + model.elseProperty().operations().get(0).name()); + Assertions.assertEquals("qw", model.elseProperty().operations().get(0).parameters().get("bmdg")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.elseProperty().operations().get(0).onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskAction model + = new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("dmgloug") + .withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("wgcu", "mutduqktaps")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty( + new ElseCondition() + .withOperations( + Arrays + .asList( + new StorageTaskOperation().withName(StorageTaskOperationName.UNDELETE_BLOB) + .withParameters(mapOf("bmdg", "qw", "dgmb", "bjf", "tq", "bexppb", + "algbquxigjyjg", "rolfpfp")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_EXPIRY) + .withParameters(mapOf("vlejuvfqa", "txilnerkujy", "xgjvtbv", "rlyxwjkcprbnw")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TAGS) + .withParameters(mapOf("guhmuouqfpr", "uj", "nguitnwuizgazxu", "zw")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.UNDELETE_BLOB) + .withParameters(mapOf("rfidfvzwdz", "i", "sdkf", "htymw")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))); + model = BinaryData.fromObject(model).toObject(StorageTaskAction.class); + Assertions.assertEquals("dmgloug", model.ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, model.ifProperty().operations().get(0).name()); + Assertions.assertEquals("mutduqktaps", model.ifProperty().operations().get(0).parameters().get("wgcu")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + model.elseProperty().operations().get(0).name()); + Assertions.assertEquals("qw", model.elseProperty().operations().get(0).parameters().get("bmdg")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.elseProperty().operations().get(0).onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentInnerTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentInnerTests.java new file mode 100644 index 000000000000..88283064e6eb --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentInnerTests.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.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskAssignmentInner; + +public final class StorageTaskAssignmentInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskAssignmentInner model + = BinaryData.fromString("{\"id\":\"zi\"}").toObject(StorageTaskAssignmentInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskAssignmentInner model = new StorageTaskAssignmentInner(); + model = BinaryData.fromObject(model).toObject(StorageTaskAssignmentInner.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListMockTests.java new file mode 100644 index 000000000000..0702b457614d --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignment; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageTaskAssignmentsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"value\":[{\"id\":\"pjflcxogao\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.storageTaskAssignments().list("d", "lvwiwubmwmbesl", "nkww", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListResultTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListResultTests.java new file mode 100644 index 000000000000..f88f2582efc6 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskAssignmentsListResultTests.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.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.StorageTaskAssignmentsListResult; + +public final class StorageTaskAssignmentsListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskAssignmentsListResult model = BinaryData + .fromString( + "{\"value\":[{\"id\":\"qzntypm\"},{\"id\":\"p\"},{\"id\":\"c\"}],\"nextLink\":\"qjsdpydnfyhxdeo\"}") + .toObject(StorageTaskAssignmentsListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskAssignmentsListResult model = new StorageTaskAssignmentsListResult(); + model = BinaryData.fromObject(model).toObject(StorageTaskAssignmentsListResult.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskInnerTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskInnerTests.java new file mode 100644 index 000000000000..0319a0b785c2 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskInnerTests.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskInner; +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import com.azure.resourcemanager.storageactions.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskInner model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"83e808b7-a5bb-4ef8-a32b-f52fe6ced0ed\",\"tenantId\":\"c81a3be9-9282-4f3a-aa0c-95ae338b9393\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"hab\":{\"principalId\":\"ad933690-5ed8-40f7-b652-331cf3feabe7\",\"clientId\":\"5cb20f5d-ec49-4423-be2d-2f29f4987496\"}}},\"properties\":{\"taskVersion\":4747702920878176636,\"enabled\":true,\"description\":\"wczbys\",\"action\":{\"if\":{\"condition\":\"npqxuh\",\"operations\":[{\"name\":\"UndeleteBlob\",\"parameters\":{\"tfwvukxgaudc\":\"iwbybrkxvdumjg\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobTags\",\"parameters\":{\"kryhtnapczwlokj\":\"j\",\"jnchgej\":\"emkkvnipjox\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTier\",\"parameters\":{\"o\":\"zyde\",\"wixjsprozvcp\":\"wyahuxinpmqnja\",\"atscmd\":\"tegjvwmf\",\"zkrwfn\":\"pjhulsuuvmkj\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"DeleteBlob\",\"parameters\":{\"jdpvwryo\":\"w\",\"hbcryffdfdosyge\":\"psoacctazakljl\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTags\",\"parameters\":{\"vdphlxaolthqtr\":\"msbzjhcrz\",\"gvfcj\":\"qjbpfzfsin\",\"xjtfelluwfzit\":\"wzo\",\"qfpjk\":\"np\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"provisioningState\":\"ValidateSubscriptionQuotaEnd\",\"creationTimeInUtc\":\"2021-11-04T07:17:51Z\"},\"location\":\"fxxypininmayhuy\",\"tags\":{\"inuvamiheogn\":\"podepoo\",\"usivye\":\"rxzxtheo\"},\"id\":\"cciqihnhungbwjz\",\"name\":\"nfygxgispemvtz\",\"type\":\"kufubljo\"}") + .toObject(StorageTaskInner.class); + Assertions.assertEquals("fxxypininmayhuy", model.location()); + Assertions.assertEquals("podepoo", model.tags().get("inuvamiheogn")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals(true, model.properties().enabled()); + Assertions.assertEquals("wczbys", model.properties().description()); + Assertions.assertEquals("npqxuh", model.properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + model.properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals("iwbybrkxvdumjg", + model.properties().action().ifProperty().operations().get(0).parameters().get("tfwvukxgaudc")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TAGS, + model.properties().action().elseProperty().operations().get(0).name()); + Assertions.assertEquals("j", + model.properties().action().elseProperty().operations().get(0).parameters().get("kryhtnapczwlokj")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().elseProperty().operations().get(0).onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskInner model + = new StorageTaskInner().withLocation("fxxypininmayhuy") + .withTags( + mapOf("inuvamiheogn", "podepoo", "usivye", "rxzxtheo")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED).withUserAssignedIdentities( + mapOf("hab", new UserAssignedIdentity()))) + .withProperties(new StorageTaskProperties().withEnabled(true).withDescription("wczbys") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("npqxuh").withOperations( + Arrays.asList(new StorageTaskOperation().withName(StorageTaskOperationName.UNDELETE_BLOB) + .withParameters(mapOf("tfwvukxgaudc", "iwbybrkxvdumjg")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations(Arrays.asList( + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TAGS) + .withParameters(mapOf("kryhtnapczwlokj", "j", "jnchgej", "emkkvnipjox")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER) + .withParameters(mapOf("o", "zyde", "wixjsprozvcp", "wyahuxinpmqnja", "atscmd", + "tegjvwmf", "zkrwfn", "pjhulsuuvmkj")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withParameters(mapOf("jdpvwryo", "w", "hbcryffdfdosyge", "psoacctazakljl")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TAGS) + .withParameters(mapOf("vdphlxaolthqtr", "msbzjhcrz", "gvfcj", "qjbpfzfsin", + "xjtfelluwfzit", "wzo", "qfpjk", "np")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))))); + model = BinaryData.fromObject(model).toObject(StorageTaskInner.class); + Assertions.assertEquals("fxxypininmayhuy", model.location()); + Assertions.assertEquals("podepoo", model.tags().get("inuvamiheogn")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals(true, model.properties().enabled()); + Assertions.assertEquals("wczbys", model.properties().description()); + Assertions.assertEquals("npqxuh", model.properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + model.properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals("iwbybrkxvdumjg", + model.properties().action().ifProperty().operations().get(0).parameters().get("tfwvukxgaudc")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TAGS, + model.properties().action().elseProperty().operations().get(0).name()); + Assertions.assertEquals("j", + model.properties().action().elseProperty().operations().get(0).parameters().get("kryhtnapczwlokj")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().elseProperty().operations().get(0).onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskOperationTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskOperationTests.java new file mode 100644 index 000000000000..6575399d44ac --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskOperationTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskOperationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskOperation model = BinaryData.fromString( + "{\"name\":\"SetBlobImmutabilityPolicy\",\"parameters\":{\"jjgpb\":\"urzafb\",\"jmkljavbqidtqajz\":\"oq\",\"hbzhfepg\":\"ulpkudjkrl\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}") + .toObject(StorageTaskOperation.class); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_IMMUTABILITY_POLICY, model.name()); + Assertions.assertEquals("urzafb", model.parameters().get("jjgpb")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskOperation model + = new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_IMMUTABILITY_POLICY) + .withParameters(mapOf("jjgpb", "urzafb", "jmkljavbqidtqajz", "oq", "hbzhfepg", "ulpkudjkrl")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK); + model = BinaryData.fromObject(model).toObject(StorageTaskOperation.class); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_IMMUTABILITY_POLICY, model.name()); + Assertions.assertEquals("urzafb", model.parameters().get("jjgpb")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionConditionTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionConditionTests.java new file mode 100644 index 000000000000..a9c02d7d40ab --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionConditionTests.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.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionCondition; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionIfCondition; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskPreviewActionConditionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskPreviewActionCondition model + = BinaryData.fromString("{\"if\":{\"condition\":\"k\"},\"elseBlockExists\":true}") + .toObject(StorageTaskPreviewActionCondition.class); + Assertions.assertEquals("k", model.ifProperty().condition()); + Assertions.assertEquals(true, model.elseBlockExists()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskPreviewActionCondition model = new StorageTaskPreviewActionCondition() + .withIfProperty(new StorageTaskPreviewActionIfCondition().withCondition("k")).withElseBlockExists(true); + model = BinaryData.fromObject(model).toObject(StorageTaskPreviewActionCondition.class); + Assertions.assertEquals("k", model.ifProperty().condition()); + Assertions.assertEquals(true, model.elseBlockExists()); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionIfConditionTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionIfConditionTests.java new file mode 100644 index 000000000000..dbdc55c62899 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPreviewActionIfConditionTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.StorageTaskPreviewActionIfCondition; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskPreviewActionIfConditionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskPreviewActionIfCondition model = BinaryData.fromString("{\"condition\":\"liourqhak\"}") + .toObject(StorageTaskPreviewActionIfCondition.class); + Assertions.assertEquals("liourqhak", model.condition()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskPreviewActionIfCondition model + = new StorageTaskPreviewActionIfCondition().withCondition("liourqhak"); + model = BinaryData.fromObject(model).toObject(StorageTaskPreviewActionIfCondition.class); + Assertions.assertEquals("liourqhak", model.condition()); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPropertiesTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPropertiesTests.java new file mode 100644 index 000000000000..4be310dfae80 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskPropertiesTests.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskProperties model = BinaryData.fromString( + "{\"taskVersion\":8951881074960566818,\"enabled\":true,\"description\":\"sntnbybkzgcw\",\"action\":{\"if\":{\"condition\":\"wclxxwrl\",\"operations\":[{\"name\":\"UndeleteBlob\",\"parameters\":{\"dkwt\":\"kcqvkocrc\",\"ssainqpjwnzll\":\"hxbnjbiksqrg\",\"bvmgxsabkyqduuji\":\"fmppe\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTier\",\"parameters\":{\"sbdkvwr\":\"vndhkrwpdapp\",\"tjelt\":\"jfeusnh\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTier\",\"parameters\":{\"tqxhocdgeab\":\"zzd\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTier\",\"parameters\":{\"aozwyiftyhxhu\":\"ndv\",\"fkgiawxk\":\"okftyxolniwpwcuk\",\"dhsgcba\":\"ryplwckbasyypn\",\"dlikwyqkgfgibma\":\"phejkotynqgoulz\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"ouf\":\"bzqqedqytbciq\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"provisioningState\":\"ValidateSubscriptionQuotaEnd\",\"creationTimeInUtc\":\"2021-10-01T10:06:40Z\"}") + .toObject(StorageTaskProperties.class); + Assertions.assertEquals(true, model.enabled()); + Assertions.assertEquals("sntnbybkzgcw", model.description()); + Assertions.assertEquals("wclxxwrl", model.action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + model.action().ifProperty().operations().get(0).name()); + Assertions.assertEquals("kcqvkocrc", model.action().ifProperty().operations().get(0).parameters().get("dkwt")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.action().ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.action().ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, + model.action().elseProperty().operations().get(0).name()); + Assertions.assertEquals("bzqqedqytbciq", + model.action().elseProperty().operations().get(0).parameters().get("ouf")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.action().elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.action().elseProperty().operations().get(0).onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskProperties model = new StorageTaskProperties().withEnabled(true).withDescription("sntnbybkzgcw") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("wclxxwrl") + .withOperations(Arrays.asList( + new StorageTaskOperation().withName(StorageTaskOperationName.UNDELETE_BLOB) + .withParameters(mapOf("dkwt", "kcqvkocrc", "ssainqpjwnzll", "hxbnjbiksqrg", + "bvmgxsabkyqduuji", "fmppe")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER) + .withParameters(mapOf("sbdkvwr", "vndhkrwpdapp", "tjelt", "jfeusnh")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER) + .withParameters(mapOf("tqxhocdgeab", "zzd")).withOnSuccess(OnSuccess.CONTINUE) + .withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER) + .withParameters(mapOf("aozwyiftyhxhu", "ndv", "fkgiawxk", "okftyxolniwpwcuk", "dhsgcba", + "ryplwckbasyypn", "dlikwyqkgfgibma", "phejkotynqgoulz")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations(Arrays.asList(new StorageTaskOperation() + .withName(StorageTaskOperationName.SET_BLOB_TIER).withParameters(mapOf("ouf", "bzqqedqytbciq")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK))))); + model = BinaryData.fromObject(model).toObject(StorageTaskProperties.class); + Assertions.assertEquals(true, model.enabled()); + Assertions.assertEquals("sntnbybkzgcw", model.description()); + Assertions.assertEquals("wclxxwrl", model.action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + model.action().ifProperty().operations().get(0).name()); + Assertions.assertEquals("kcqvkocrc", model.action().ifProperty().operations().get(0).parameters().get("dkwt")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.action().ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.action().ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, + model.action().elseProperty().operations().get(0).name()); + Assertions.assertEquals("bzqqedqytbciq", + model.action().elseProperty().operations().get(0).parameters().get("ouf")); + Assertions.assertEquals(OnSuccess.CONTINUE, model.action().elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, model.action().elseProperty().operations().get(0).onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportInstanceInnerTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportInstanceInnerTests.java new file mode 100644 index 000000000000..84e420fa609e --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportInstanceInnerTests.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.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.fluent.models.StorageTaskReportInstanceInner; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportProperties; + +public final class StorageTaskReportInstanceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskReportInstanceInner model = BinaryData.fromString( + "{\"properties\":{\"taskAssignmentId\":\"baiuebbaumny\",\"storageAccountId\":\"ped\",\"startTime\":\"jn\",\"finishTime\":\"ckhsmtxpsieb\",\"objectsTargetedCount\":\"hvpesapskrdqm\",\"objectsOperatedOnCount\":\"jdhtldwkyzxu\",\"objectFailedCount\":\"kn\",\"objectsSucceededCount\":\"scwsv\",\"runStatusError\":\"otogtwrupqs\",\"runStatusEnum\":\"InProgress\",\"summaryReportPath\":\"i\",\"taskId\":\"kvceoveilovnotyf\",\"taskVersion\":\"cnjbkcnxdhbt\",\"runResult\":\"Succeeded\"},\"id\":\"ywpnvjt\",\"name\":\"qnermclfplphoxu\",\"type\":\"crpab\"}") + .toObject(StorageTaskReportInstanceInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskReportInstanceInner model + = new StorageTaskReportInstanceInner().withProperties(new StorageTaskReportProperties()); + model = BinaryData.fromObject(model).toObject(StorageTaskReportInstanceInner.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportPropertiesTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportPropertiesTests.java new file mode 100644 index 000000000000..ce106294ec42 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportPropertiesTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportProperties; + +public final class StorageTaskReportPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskReportProperties model = BinaryData.fromString( + "{\"taskAssignmentId\":\"epsbjtazqu\",\"storageAccountId\":\"ywpmueefjzwfqkq\",\"startTime\":\"ids\",\"finishTime\":\"onobglaocqx\",\"objectsTargetedCount\":\"cmgyud\",\"objectsOperatedOnCount\":\"tlmoyrx\",\"objectFailedCount\":\"fudwpznt\",\"objectsSucceededCount\":\"dzhlrq\",\"runStatusError\":\"hckfrlhrx\",\"runStatusEnum\":\"InProgress\",\"summaryReportPath\":\"vpycanuzbp\",\"taskId\":\"afkuwb\",\"taskVersion\":\"nwbmeh\",\"runResult\":\"Failed\"}") + .toObject(StorageTaskReportProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskReportProperties model = new StorageTaskReportProperties(); + model = BinaryData.fromObject(model).toObject(StorageTaskReportProperties.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportSummaryTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportSummaryTests.java new file mode 100644 index 000000000000..3eff706d35b6 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskReportSummaryTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportSummary; + +public final class StorageTaskReportSummaryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskReportSummary model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"taskAssignmentId\":\"jttgzf\",\"storageAccountId\":\"shcbkhajdeyeamdp\",\"startTime\":\"g\",\"finishTime\":\"pbuxwgipwhon\",\"objectsTargetedCount\":\"kgshwa\",\"objectsOperatedOnCount\":\"ixzbinjeputtmryw\",\"objectFailedCount\":\"zoqftiyqzrnkcqvy\",\"objectsSucceededCount\":\"whzlsicohoq\",\"runStatusError\":\"wvl\",\"runStatusEnum\":\"Finished\",\"summaryReportPath\":\"w\",\"taskId\":\"eun\",\"taskVersion\":\"qhgyxzkonocukok\",\"runResult\":\"Succeeded\"},\"id\":\"uconuqszfkbey\",\"name\":\"ewrmjmwvvjektc\",\"type\":\"senhwlrs\"},{\"properties\":{\"taskAssignmentId\":\"zpwv\",\"storageAccountId\":\"dqgbiqylihkaetc\",\"startTime\":\"vfcivfsnkymuc\",\"finishTime\":\"hjfbebrjcxe\",\"objectsTargetedCount\":\"uwutttxfvjrbi\",\"objectsOperatedOnCount\":\"hxepcyvahfnlj\",\"objectFailedCount\":\"qxj\",\"objectsSucceededCount\":\"ujqgidok\",\"runStatusError\":\"ljyoxgvcltb\",\"runStatusEnum\":\"InProgress\",\"summaryReportPath\":\"ghkjeszzhbi\",\"taskId\":\"txfvgx\",\"taskVersion\":\"smx\",\"runResult\":\"Succeeded\"},\"id\":\"pvecxgodeb\",\"name\":\"qkkrb\",\"type\":\"pukgriwflzlfb\"},{\"properties\":{\"taskAssignmentId\":\"uzycispnqza\",\"storageAccountId\":\"gkbrpyyd\",\"startTime\":\"bnuqqkpik\",\"finishTime\":\"rgvtqag\",\"objectsTargetedCount\":\"uynhijg\",\"objectsOperatedOnCount\":\"ebf\",\"objectFailedCount\":\"arbu\",\"objectsSucceededCount\":\"cvpnazzmhjrunmpx\",\"runStatusError\":\"dbhrbnlankxm\",\"runStatusEnum\":\"InProgress\",\"summaryReportPath\":\"bhenbtkcxywnyt\",\"taskId\":\"synlqidybyxczfc\",\"taskVersion\":\"aaxdbabphlwrq\",\"runResult\":\"Failed\"},\"id\":\"sthsu\",\"name\":\"ocmnyyazttbtwwrq\",\"type\":\"uedck\"},{\"properties\":{\"taskAssignmentId\":\"biexzfeyu\",\"storageAccountId\":\"xibxujwbhqwalm\",\"startTime\":\"yoxa\",\"finishTime\":\"dkzjancuxrh\",\"objectsTargetedCount\":\"bavxbniwdjswzt\",\"objectsOperatedOnCount\":\"bpg\",\"objectFailedCount\":\"ytxhp\",\"objectsSucceededCount\":\"bzpfzab\",\"runStatusError\":\"cuh\",\"runStatusEnum\":\"InProgress\",\"summaryReportPath\":\"tyq\",\"taskId\":\"lbbovplw\",\"taskVersion\":\"hvgyuguosvmk\",\"runResult\":\"Succeeded\"},\"id\":\"qukkfp\",\"name\":\"gmgsxnkjzkde\",\"type\":\"lpvlopw\"}],\"nextLink\":\"ighxpk\"}") + .toObject(StorageTaskReportSummary.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskReportSummary model = new StorageTaskReportSummary(); + model = BinaryData.fromObject(model).toObject(StorageTaskReportSummary.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskUpdateParametersTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskUpdateParametersTests.java new file mode 100644 index 000000000000..f563f2f49af3 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTaskUpdateParametersTests.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.OnFailure; +import com.azure.resourcemanager.storageactions.models.OnSuccess; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import com.azure.resourcemanager.storageactions.models.StorageTaskUpdateParameters; +import com.azure.resourcemanager.storageactions.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageTaskUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTaskUpdateParameters model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"420e56ab-ec1e-461b-a795-2283ac80f946\",\"tenantId\":\"9481aa93-0af4-463c-a199-e281d8165022\",\"type\":\"None\",\"userAssignedIdentities\":{\"bdxkqpxokaj\":{\"principalId\":\"69920218-4471-49e7-a35e-acb644abe102\",\"clientId\":\"17505a17-f98c-476b-ae2d-cff2ac30ec0e\"},\"pimexgstxgcpodg\":{\"principalId\":\"3d014324-4819-48e2-ad99-9041cef9a290\",\"clientId\":\"40460eb0-b187-4fac-9696-8aacb6896bea\"},\"jrmvdjwzrlo\":{\"principalId\":\"09a96325-100a-499f-9ae5-54486760a915\",\"clientId\":\"a2350f52-3d8e-4218-a582-c9580f266c87\"},\"lwhijcoejctbzaq\":{\"principalId\":\"69e520ad-8c41-444d-9741-ada98a58689d\",\"clientId\":\"4a000af0-b8dc-4aed-9d4d-be3bb0cd380e\"}}},\"tags\":{\"bkbfkgukdkex\":\"y\",\"ocjjxhvpmouexh\":\"ppofmxaxcfjpgdd\"},\"properties\":{\"taskVersion\":986313719569038785,\"enabled\":true,\"description\":\"eojnxqbzvddn\",\"action\":{\"if\":{\"condition\":\"wndeicbtwnp\",\"operations\":[{\"name\":\"SetBlobLegalHold\",\"parameters\":{\"jthjqkwpyei\":\"uhrhcffcyddgl\",\"q\":\"xmqci\",\"xuigdtopbobj\":\"hkh\",\"uhrzayvvt\":\"ghmewuam\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"SetBlobTags\",\"parameters\":{\"efgugnxk\":\"tkftutqxlngx\",\"hjybigehoqfbo\":\"xdqmidtthzrvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\",\"ocpecfvmmco\":\"nhzgpphrcgyn\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobTags\",\"parameters\":{\"jqabcypmivkwlzuv\":\"m\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"},{\"name\":\"DeleteBlob\",\"parameters\":{\"nlebxetqgtzxd\":\"acfi\",\"feallnwsu\":\"nqbqqwxr\",\"c\":\"isnjampmngnz\",\"ochcbonqvpkvl\":\"aqw\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"provisioningState\":\"Failed\",\"creationTimeInUtc\":\"2021-02-05T10:28:18Z\"}}") + .toObject(StorageTaskUpdateParameters.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("y", model.tags().get("bkbfkgukdkex")); + Assertions.assertEquals(true, model.properties().enabled()); + Assertions.assertEquals("eojnxqbzvddn", model.properties().description()); + Assertions.assertEquals("wndeicbtwnp", model.properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_LEGAL_HOLD, + model.properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals("uhrhcffcyddgl", + model.properties().action().ifProperty().operations().get(0).parameters().get("jthjqkwpyei")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TAGS, + model.properties().action().elseProperty().operations().get(0).name()); + Assertions.assertEquals("m", + model.properties().action().elseProperty().operations().get(0).parameters().get("jqabcypmivkwlzuv")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().elseProperty().operations().get(0).onFailure()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTaskUpdateParameters model + = new StorageTaskUpdateParameters() + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf( + "bdxkqpxokaj", new UserAssignedIdentity(), "pimexgstxgcpodg", new UserAssignedIdentity(), + "jrmvdjwzrlo", new UserAssignedIdentity(), "lwhijcoejctbzaq", new UserAssignedIdentity()))) + .withTags(mapOf("bkbfkgukdkex", "y", "ocjjxhvpmouexh", "ppofmxaxcfjpgdd")) + .withProperties(new StorageTaskProperties().withEnabled(true).withDescription("eojnxqbzvddn") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("wndeicbtwnp").withOperations(Arrays.asList( + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_LEGAL_HOLD) + .withParameters(mapOf("jthjqkwpyei", "uhrhcffcyddgl", "q", "xmqci", "xuigdtopbobj", + "hkh", "uhrzayvvt", "ghmewuam")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TAGS) + .withParameters(mapOf("efgugnxk", "tkftutqxlngx", "hjybigehoqfbo", "xdqmidtthzrvqdra", + "zlcuiywgqywgndrv", "skanyk", "ocpecfvmmco", "nhzgpphrcgyn")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))) + .withElseProperty(new ElseCondition().withOperations(Arrays.asList( + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TAGS) + .withParameters(mapOf("jqabcypmivkwlzuv", "m")).withOnSuccess(OnSuccess.CONTINUE) + .withOnFailure(OnFailure.BREAK), + new StorageTaskOperation().withName(StorageTaskOperationName.DELETE_BLOB) + .withParameters(mapOf("nlebxetqgtzxd", "acfi", "feallnwsu", "nqbqqwxr", "c", + "isnjampmngnz", "ochcbonqvpkvl", "aqw")) + .withOnSuccess(OnSuccess.CONTINUE).withOnFailure(OnFailure.BREAK)))))); + model = BinaryData.fromObject(model).toObject(StorageTaskUpdateParameters.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("y", model.tags().get("bkbfkgukdkex")); + Assertions.assertEquals(true, model.properties().enabled()); + Assertions.assertEquals("eojnxqbzvddn", model.properties().description()); + Assertions.assertEquals("wndeicbtwnp", model.properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_LEGAL_HOLD, + model.properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals("uhrhcffcyddgl", + model.properties().action().ifProperty().operations().get(0).parameters().get("jthjqkwpyei")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().ifProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().ifProperty().operations().get(0).onFailure()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TAGS, + model.properties().action().elseProperty().operations().get(0).name()); + Assertions.assertEquals("m", + model.properties().action().elseProperty().operations().get(0).parameters().get("jqabcypmivkwlzuv")); + Assertions.assertEquals(OnSuccess.CONTINUE, + model.properties().action().elseProperty().operations().get(0).onSuccess()); + Assertions.assertEquals(OnFailure.BREAK, + model.properties().action().elseProperty().operations().get(0).onFailure()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateMockTests.java new file mode 100644 index 000000000000..6a9d48ce9e00 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksCreateMockTests.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.ElseCondition; +import com.azure.resourcemanager.storageactions.models.IfCondition; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskAction; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperation; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import com.azure.resourcemanager.storageactions.models.StorageTaskProperties; +import com.azure.resourcemanager.storageactions.models.UserAssignedIdentity; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageTasksCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"identity\":{\"principalId\":\"496531ec-078c-41a1-b292-20c319031924\",\"tenantId\":\"99cc0d84-e433-4f1e-a62b-8a869c838859\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"gynduha\":{\"principalId\":\"4dbef6ab-4ed9-4317-8e11-7edb11a24e8d\",\"clientId\":\"6d0d556f-0590-49e0-be15-8310379ae856\"}}},\"properties\":{\"taskVersion\":5319393141348418027,\"enabled\":false,\"description\":\"humaqolbgyc\",\"action\":{\"if\":{\"condition\":\"uie\",\"operations\":[{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTier\"},{\"name\":\"SetBlobImmutabilityPolicy\"}]},\"else\":{\"operations\":[{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobTier\"},{\"name\":\"DeleteBlob\"}]}},\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2021-10-20T11:28:50Z\"},\"location\":\"lfmmdnbbglzpswi\",\"tags\":{\"bzmnvdfznud\":\"cwyhzdxssa\",\"xzb\":\"od\",\"dzu\":\"cblylpstdbhhxsr\",\"fiwjmygtdssls\":\"erscdntne\"},\"id\":\"tmweriofzpyq\",\"name\":\"emwabnet\",\"type\":\"hhszh\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + StorageTask response + = manager.storageTasks().define("xoblytkbl").withRegion("l").withExistingResourceGroup("qmcbxvwvxyslqbhs") + .withTags(mapOf("jmkcjhwqytj", "fqqnvwpmqtaruo", "jewgdrjerv", "ybn")) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("rvrnsvshqjohxc", new UserAssignedIdentity(), "fovasr", + new UserAssignedIdentity(), "wbhsqfsub", new UserAssignedIdentity()))) + .withProperties( + new StorageTaskProperties() + .withEnabled(false).withDescription( + "xb") + .withAction(new StorageTaskAction() + .withIfProperty(new IfCondition().withCondition("ybsrfbjfdtwss") + .withOperations(Arrays.asList( + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER)))) + .withElseProperty(new ElseCondition().withOperations(Arrays.asList( + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TAGS), + new StorageTaskOperation().withName(StorageTaskOperationName.SET_BLOB_TIER)))))) + .create(); + + Assertions.assertEquals("lfmmdnbbglzpswi", response.location()); + Assertions.assertEquals("cwyhzdxssa", response.tags().get("bzmnvdfznud")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals(false, response.properties().enabled()); + Assertions.assertEquals("humaqolbgyc", response.properties().description()); + Assertions.assertEquals("uie", response.properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_IMMUTABILITY_POLICY, + response.properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals(StorageTaskOperationName.DELETE_BLOB, + response.properties().action().elseProperty().operations().get(0).name()); + } + + // Use "Map.of" if available + @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/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupWithResponseMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..9742712f9b1e --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksGetByResourceGroupWithResponseMockTests.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.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageTasksGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"identity\":{\"principalId\":\"463cdcac-3402-4d57-9df7-28ca146dd88d\",\"tenantId\":\"36fc4815-7972-499e-910d-60a44d18aecb\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"awgqwgxhni\":{\"principalId\":\"f2cfa7dc-89ee-4bc2-8ba3-8ebd33522cf1\",\"clientId\":\"acdf96ff-d771-4c5c-a1b0-0b0677e5d05f\"},\"fbkp\":{\"principalId\":\"64b2a031-8cdf-4384-bb80-2f2d6db78c23\",\"clientId\":\"8d3c9b0b-c5a4-4bc6-8cba-de46f6fb809e\"},\"klwndnhjdauwhv\":{\"principalId\":\"11301dfe-ca41-45c0-9ca2-6f76e1ae32c6\",\"clientId\":\"cfb214ab-25d6-400d-8d72-7260f7c080fe\"}}},\"properties\":{\"taskVersion\":3762934959589982311,\"enabled\":true,\"description\":\"dhxujznbmpo\",\"action\":{\"if\":{\"condition\":\"uwprzql\",\"operations\":[{\"name\":\"SetBlobTier\"},{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobLegalHold\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTier\"}]}},\"provisioningState\":\"Creating\",\"creationTimeInUtc\":\"2021-08-19T13:39:55Z\"},\"location\":\"bcswsrt\",\"tags\":{\"blcg\":\"plrbpbewtghf\",\"nmxiebwwaloayqc\":\"xzvlvqhjkbegib\",\"uzgwyzmhtx\":\"wrtz\",\"wxqpsrknftguvri\":\"ngmtsavjcb\"},\"id\":\"hprwmdyv\",\"name\":\"qtayri\",\"type\":\"wroyqbexrmcq\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + StorageTask response = manager.storageTasks() + .getByResourceGroupWithResponse("rw", "ueiotwmcdyt", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("bcswsrt", response.location()); + Assertions.assertEquals("plrbpbewtghf", response.tags().get("blcg")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals(true, response.properties().enabled()); + Assertions.assertEquals("dhxujznbmpo", response.properties().description()); + Assertions.assertEquals("uwprzql", response.properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_TIER, + response.properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_IMMUTABILITY_POLICY, + response.properties().action().elseProperty().operations().get(0).name()); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupMockTests.java new file mode 100644 index 000000000000..ee2b043ad06e --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListByResourceGroupMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageTasksListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"identity\":{\"principalId\":\"04894d15-04e7-4cf0-9d69-feb5cb2982c4\",\"tenantId\":\"a70029d4-c9aa-48ba-83d8-09382897cab2\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"knalaulppg\":{\"principalId\":\"d25de069-4463-4b96-a6ce-b75be33579b7\",\"clientId\":\"2ed22701-4c3b-49c0-a58c-5827995f4b22\"},\"pnapnyiropuh\":{\"principalId\":\"04e0fd22-d9a0-452c-af94-8043f84f6985\",\"clientId\":\"b64a58c0-2002-4c24-962f-f926f17784a0\"},\"vpgylgqgitxmed\":{\"principalId\":\"4f8c14cc-d7d3-4aa0-86a7-d0c8f7372886\",\"clientId\":\"370dbdfa-13ca-4fa7-b3c9-b06259ff16ee\"},\"slynqwwnc\":{\"principalId\":\"f742c410-7782-4883-a37e-8cdf109f5cf1\",\"clientId\":\"84c64f10-9ebc-48f0-a2ff-683b551ecbda\"}}},\"properties\":{\"taskVersion\":2313446192917643442,\"enabled\":true,\"description\":\"ktrmgucnapkt\",\"action\":{\"if\":{\"condition\":\"oellwp\",\"operations\":[{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobLegalHold\"},{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTags\"}]},\"else\":{\"operations\":[{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTags\"}]}},\"provisioningState\":\"Canceled\",\"creationTimeInUtc\":\"2021-03-25T11:42:18Z\"},\"location\":\"fqrhhuaopppc\",\"tags\":{\"t\":\"xolzdahzx\",\"grcfb\":\"bgbkdmoizpost\",\"bpvjymjhx\":\"nrmfqjhhk\"},\"id\":\"j\",\"name\":\"n\",\"type\":\"u\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.storageTasks().listByResourceGroup("exznelixhnr", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fqrhhuaopppc", response.iterator().next().location()); + Assertions.assertEquals("xolzdahzx", response.iterator().next().tags().get("t")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, + response.iterator().next().identity().type()); + Assertions.assertEquals(true, response.iterator().next().properties().enabled()); + Assertions.assertEquals("ktrmgucnapkt", response.iterator().next().properties().description()); + Assertions.assertEquals("oellwp", response.iterator().next().properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.SET_BLOB_IMMUTABILITY_POLICY, + response.iterator().next().properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals(StorageTaskOperationName.DELETE_BLOB, + response.iterator().next().properties().action().elseProperty().operations().get(0).name()); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListMockTests.java new file mode 100644 index 000000000000..46d8979e48d0 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.storageactions.models.StorageTask; +import com.azure.resourcemanager.storageactions.models.StorageTaskOperationName; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageTasksListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"identity\":{\"principalId\":\"0e0baf01-1b68-440e-974d-6b605a3fedc2\",\"tenantId\":\"af70cd24-bae4-4560-8ee0-49baf3d800ea\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"nmefqsgzvahapj\":{\"principalId\":\"1a05b8c0-edfb-4099-ba60-c988cab9e389\",\"clientId\":\"2eb95787-91f2-445a-b5f6-db0733e622f6\"}}},\"properties\":{\"taskVersion\":7368048825846520103,\"enabled\":false,\"description\":\"qzcjrvxdj\",\"action\":{\"if\":{\"condition\":\"lmwlxkvugfhzo\",\"operations\":[{\"name\":\"UndeleteBlob\"},{\"name\":\"SetBlobLegalHold\"},{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTags\"}]},\"else\":{\"operations\":[{\"name\":\"UndeleteBlob\"},{\"name\":\"SetBlobExpiry\"}]}},\"provisioningState\":\"Creating\",\"creationTimeInUtc\":\"2021-09-06T05:22:37Z\"},\"location\":\"rnxipei\",\"tags\":{\"ltskzbbtd\":\"zuaejxd\",\"bsjyofdx\":\"umveekgpwozuhkf\",\"oekqvk\":\"uusdttouwa\",\"vbxwyjsflhh\":\"lns\"},\"id\":\"aalnjixi\",\"name\":\"xyawj\",\"type\":\"yaqcslyjpkiidz\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.storageTasks().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("rnxipei", response.iterator().next().location()); + Assertions.assertEquals("zuaejxd", response.iterator().next().tags().get("ltskzbbtd")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals(false, response.iterator().next().properties().enabled()); + Assertions.assertEquals("qzcjrvxdj", response.iterator().next().properties().description()); + Assertions.assertEquals("lmwlxkvugfhzo", + response.iterator().next().properties().action().ifProperty().condition()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + response.iterator().next().properties().action().ifProperty().operations().get(0).name()); + Assertions.assertEquals(StorageTaskOperationName.UNDELETE_BLOB, + response.iterator().next().properties().action().elseProperty().operations().get(0).name()); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListResultTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListResultTests.java new file mode 100644 index 000000000000..d97c53c63771 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.StorageTasksListResult; + +public final class StorageTasksListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageTasksListResult model = BinaryData.fromString( + "{\"value\":[{\"identity\":{\"principalId\":\"6613f253-9fd6-49d3-aaf1-39b1f4674a7b\",\"tenantId\":\"5b5fa0e9-af96-4b6d-a6ea-852061ff7406\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"y\":{\"principalId\":\"8f5806c4-4011-4c2b-bbe2-f5050050c424\",\"clientId\":\"944b8738-cc8e-4f67-96c0-140d3c657b94\"},\"jbdlwtgrhpdjpju\":{\"principalId\":\"89c29dea-77ec-4330-b8e8-c79d77ed905b\",\"clientId\":\"0bf7a360-f498-476b-8d31-4a6092de7d0b\"}}},\"properties\":{\"taskVersion\":4349636942449523138,\"enabled\":false,\"description\":\"jpqyegu\",\"action\":{\"if\":{\"condition\":\"lhbxxhejjzzvdud\",\"operations\":[{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobExpiry\"},{\"name\":\"SetBlobTier\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobExpiry\"},{\"name\":\"DeleteBlob\"},{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobTags\"}]}},\"provisioningState\":\"Deleting\",\"creationTimeInUtc\":\"2021-01-27T06:45:01Z\"},\"location\":\"lbjnpgacftadehx\",\"tags\":{\"uesnzwdejbavo\":\"yfsoppu\",\"vudwx\":\"xzdmohctb\",\"gujjugwdkcglh\":\"ndnvo\",\"ofqweykhmenevfye\":\"lazjdyggdtjixhbk\"},\"id\":\"fwhybcibvy\",\"name\":\"dcsi\",\"type\":\"ynnaam\"},{\"identity\":{\"principalId\":\"3908ea50-3495-4dc1-ad41-ba0c33429fe5\",\"tenantId\":\"f388df6a-e9e5-444a-b1cb-b4f3244a0a74\",\"type\":\"None\",\"userAssignedIdentities\":{\"scjeypv\":{\"principalId\":\"b25d4190-798a-43b4-a2e2-1be710a92a95\",\"clientId\":\"e2e792fd-d5f4-4e1a-a823-0dc13df1e4fc\"}}},\"properties\":{\"taskVersion\":3144809064731797978,\"enabled\":true,\"description\":\"q\",\"action\":{\"if\":{\"condition\":\"c\",\"operations\":[{\"name\":\"SetBlobTier\"},{\"name\":\"SetBlobLegalHold\"},{\"name\":\"SetBlobTags\"},{\"name\":\"UndeleteBlob\"}]},\"else\":{\"operations\":[{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobLegalHold\"},{\"name\":\"SetBlobExpiry\"}]}},\"provisioningState\":\"Deleting\",\"creationTimeInUtc\":\"2021-08-20T18:32:02Z\"},\"location\":\"xyqj\",\"tags\":{\"jh\":\"attpngjcrcczsq\",\"ysou\":\"mdajv\",\"canoaeupf\":\"q\",\"tuo\":\"yhltrpmopjmcm\"},\"id\":\"thfuiuaodsfcpkvx\",\"name\":\"dpuozmyz\",\"type\":\"dagfuaxbezyiuok\"},{\"identity\":{\"principalId\":\"3c2ba404-ec2a-4735-b73f-83da124badfb\",\"tenantId\":\"9cca81f9-dc9c-4f88-bed3-15986fec25fa\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ywqsmbsurexim\":{\"principalId\":\"a0c9881e-8c73-4560-9ed2-caf1199e6488\",\"clientId\":\"b60b4c02-30c4-4919-8ae6-b020228fd456\"}}},\"properties\":{\"taskVersion\":4342038682597268889,\"enabled\":true,\"description\":\"sfksy\",\"action\":{\"if\":{\"condition\":\"ddystkiiuxhqy\",\"operations\":[{\"name\":\"SetBlobLegalHold\"},{\"name\":\"SetBlobTier\"},{\"name\":\"SetBlobExpiry\"},{\"name\":\"SetBlobTags\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTags\"},{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobImmutabilityPolicy\"}]}},\"provisioningState\":\"Canceled\",\"creationTimeInUtc\":\"2021-06-20T18:48:12Z\"},\"location\":\"qrvkdv\",\"tags\":{\"d\":\"lrmv\"},\"id\":\"watkpnpulexxb\",\"name\":\"zwtruwiqzbqjvsov\",\"type\":\"yokacspkw\"},{\"identity\":{\"principalId\":\"179c4c3b-0f99-46d5-b43b-3e01c294e634\",\"tenantId\":\"79816dcb-5a8f-44d5-8a0a-953fc00c16a6\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"mflbv\":{\"principalId\":\"cf1dcccc-c16a-4c0e-ba40-4dacdd3e0ba6\",\"clientId\":\"0931525f-5d9d-404e-ae55-57da621548b4\"},\"hrk\":{\"principalId\":\"06784bd0-88cc-4cce-aa43-be92061d5241\",\"clientId\":\"5f36602a-3494-4491-86d2-15137916c487\"},\"wwzjuqkhrsajiwku\":{\"principalId\":\"0502c9a5-51c0-4ed9-a128-bbf42b8a79b5\",\"clientId\":\"cac87cdd-5f91-47ee-8ddc-dc664a92f7a1\"},\"skghsauuimj\":{\"principalId\":\"42df09e5-44c8-4bf9-b5a1-11c94e7ec222\",\"clientId\":\"4452d8a5-8698-44a8-9ad6-55d052468711\"}}},\"properties\":{\"taskVersion\":2519768107676496444,\"enabled\":true,\"description\":\"uugidyjrrfby\",\"action\":{\"if\":{\"condition\":\"osvexcsonpclhoc\",\"operations\":[{\"name\":\"SetBlobImmutabilityPolicy\"},{\"name\":\"SetBlobTier\"},{\"name\":\"UndeleteBlob\"}]},\"else\":{\"operations\":[{\"name\":\"DeleteBlob\"},{\"name\":\"SetBlobExpiry\"},{\"name\":\"SetBlobExpiry\"},{\"name\":\"SetBlobExpiry\"}]}},\"provisioningState\":\"ValidateSubscriptionQuotaBegin\",\"creationTimeInUtc\":\"2021-09-05T06:09:57Z\"},\"location\":\"fmvfaxkffeiit\",\"tags\":{\"zy\":\"m\",\"burvjxxjnspy\":\"shxmzsbbzoggigrx\"},\"id\":\"ptkoenkoukn\",\"name\":\"udwtiukbl\",\"type\":\"ngkpocipazy\"}],\"nextLink\":\"egukgjnpiucg\"}") + .toObject(StorageTasksListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageTasksListResult model = new StorageTasksListResult(); + model = BinaryData.fromObject(model).toObject(StorageTasksListResult.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportsListMockTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportsListMockTests.java new file mode 100644 index 000000000000..2ff9d267bd2b --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/StorageTasksReportsListMockTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.storageactions.StorageActionsManager; +import com.azure.resourcemanager.storageactions.models.StorageTaskReportInstance; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageTasksReportsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"taskAssignmentId\":\"dxbx\",\"storageAccountId\":\"kbogqxndlkzgx\",\"startTime\":\"ripl\",\"finishTime\":\"odxun\",\"objectsTargetedCount\":\"ebxmubyynt\",\"objectsOperatedOnCount\":\"rbqtkoie\",\"objectFailedCount\":\"eotg\",\"objectsSucceededCount\":\"l\",\"runStatusError\":\"muwlauwzizxbm\",\"runStatusEnum\":\"InProgress\",\"summaryReportPath\":\"efuzmuvpbttd\",\"taskId\":\"orppxebmnzbtb\",\"taskVersion\":\"pglkf\",\"runResult\":\"Failed\"},\"id\":\"neuelfphsdyhtoz\",\"name\":\"ikdowwquuvx\",\"type\":\"xclvit\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + StorageActionsManager manager = StorageActionsManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.storageTasksReports().list("onz", "nsikvmkqzeqqkdl", + "fzxmhhvhgureodkw", "bdagxt", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/UserAssignedIdentityTests.java b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..4340ab321190 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/java/com/azure/resourcemanager/storageactions/generated/UserAssignedIdentityTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storageactions.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.storageactions.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = BinaryData.fromString( + "{\"principalId\":\"5279c20c-c056-4247-a8ee-309b3043f9bf\",\"clientId\":\"be706a55-5203-4fb2-a765-1dfc2f3df44a\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000000..1f0955d450f0 --- /dev/null +++ b/sdk/storageactions/azure-resourcemanager-storageactions/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline