From 3a18f4bfdb37dc41cfff0e78c13780a4ad88820c Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Mon, 6 Jan 2020 20:40:51 -0800 Subject: [PATCH 1/2] Added JUL as default logging and added junit tests --- .github/CODEOWNERS | 41 +- CONTRIBUTING.md | 69 +- README.md | 26 +- eng/.docsettings.yml | 170 +- .../checkstyle/checkstyle-suppressions.xml | 11 + eng/docgeneration/Generate-DocIndex.ps1 | 164 ++ eng/jacoco-test-coverage/pom.xml | 38 +- eng/pipelines/docindex.yml | 181 +- .../templates/jobs/archetype-sdk-client.yml | 48 +- .../jobs/archetype-sdk-tests-pre-sdk.yml | 2 +- .../templates/jobs/archetype-sdk-tests.yml | 2 +- eng/spotbugs-aggregate-report/pom.xml | 41 +- eng/versioning/external_dependencies.txt | 2 +- eng/versioning/pom_file_version_scanner.ps1 | 68 +- eng/versioning/set_versions.py | 231 ++- eng/versioning/update_versions.py | 24 +- eng/versioning/utils.py | 26 +- eng/versioning/version_client.txt | 42 +- eng/versioning/version_client_java_files.txt | 6 - eng/versioning/version_data.txt | 10 +- packages.md | 222 +++ pom.client.xml | 15 +- pom.xml | 3 +- .../azure-data-appconfiguration/CHANGELOG.md | 40 +- .../azure-data-appconfiguration/README.md | 232 ++- .../azure-data-appconfiguration/pom.xml | 6 +- .../ConfigurationAsyncClient.java | 19 +- .../ConfigurationClientBuilder.java | 22 +- .../src/samples/README.md | 2 +- .../appconfiguration/AadAuthentication.java | 12 +- .../data/appconfiguration/ReadmeSamples.java | 175 ++ .../{readme.md => README.md} | 0 .../{changelog.md => CHANGELOG.md} | 25 +- sdk/core/azure-core-amqp/CHANGELOG.md | 61 + sdk/core/azure-core-amqp/README.md | 2 +- sdk/core/azure-core-amqp/pom.xml | 4 +- .../amqp/implementation/ClientConstants.java | 8 +- .../implementation/ReactorConnection.java | 7 +- .../ReactorHandlerProvider.java | 14 +- .../handler/ConnectionHandler.java | 30 +- .../handler/WebSocketsConnectionHandler.java | 8 +- .../WebSocketsProxyConnectionHandler.java | 7 +- .../MockReactorHandlerProvider.java | 5 +- .../implementation/ReactorConnectionTest.java | 10 +- .../ReactorHandlerProviderTest.java | 11 +- .../handler/ConnectionHandlerTest.java | 8 +- .../WebSocketsConnectionHandlerTest.java | 9 +- .../WebSocketsProxyConnectionHandlerTest.java | 15 +- sdk/core/azure-core-http-netty/CHANGELOG.md | 14 + sdk/core/azure-core-http-netty/README.md | 2 +- sdk/core/azure-core-http-netty/pom.xml | 8 +- sdk/core/azure-core-http-okhttp/CHANGELOG.md | 12 + sdk/core/azure-core-http-okhttp/README.md | 2 +- sdk/core/azure-core-http-okhttp/pom.xml | 8 +- sdk/core/azure-core-management/CHANGELOG.md | 8 + sdk/core/azure-core-management/pom.xml | 6 +- sdk/core/azure-core-test/CHANGELOG.md | 18 + sdk/core/azure-core-test/README.md | 2 +- sdk/core/azure-core-test/pom.xml | 4 +- .../CHANGELOG.md | 16 +- .../azure-core-tracing-opencensus/README.md | 2 +- .../azure-core-tracing-opencensus/pom.xml | 2 +- .../src/samples/AsyncListKeyVaultSecrets.md | 4 +- .../AsyncQueueClientEnqueueMessages.md | 4 +- .../src/samples/ListeKeyVaultSecrets.md | 4 +- .../src/samples/PublishEvents.md | 4 +- .../src/samples/QueueClientEnqueueMessages.md | 4 +- .../CHANGELOG.md | 5 +- .../README.md | 2 +- .../azure-core-tracing-opentelemetry/pom.xml | 2 +- .../samples/AsyncListKeyVaultSecretsSample.md | 4 +- ...CreateConfigurationSettingTracingSample.md | 4 +- .../ListKeyVaultSecretsTracingSample.md | 4 +- .../src/samples/PublishEventsTracingSample.md | 4 +- sdk/core/azure-core/CHANGELOG.md | 13 +- sdk/core/azure-core/README.md | 2 +- sdk/core/azure-core/pom.xml | 14 +- .../core/http/policy/HttpLoggingPolicy.java | 11 +- .../azure/core/implementation/LogLevel.java | 49 - .../core/implementation/LoggingUtil.java | 15 +- .../azure/core/util/logging/ClientLogger.java | 125 +- .../com/azure/core/util/logging/LogLevel.java | 90 + .../com/azure/core/util/tracing/Tracer.java | 2 +- .../azure-core/src/main/java/module-info.java | 2 +- .../src/main/resources/logging.properties | 1 + .../http/policy/HttpLoggingPolicyTests.java | 151 +- .../core/util/logging/ClientLoggerTests.java | 225 +-- sdk/cosmos/CODEOWNERS | 2 +- sdk/cosmos/README.md | 2 +- sdk/cosmos/changelog/README.md | 27 +- .../microsoft-azure-cosmos-benchmark/pom.xml | 4 +- .../microsoft-azure-cosmos-examples/pom.xml | 4 +- sdk/cosmos/microsoft-azure-cosmos/pom.xml | 8 +- .../data/cosmos/internal/HttpConstants.java | 2 +- .../RntbdTransportClient.java | 204 +- .../RntbdClientChannelHealthChecker.java | 54 +- .../rntbd/RntbdClientChannelPool.java | 6 +- .../rntbd/RntbdEndpoint.java | 5 + .../rntbd/RntbdObjectMapper.java | 32 +- .../rntbd/RntbdRequestRecord.java | 1 + .../rntbd/RntbdRequestTimer.java | 43 +- .../rntbd/RntbdServiceEndpoint.java | 9 +- .../internal/http/ReactorNettyClient.java | 17 +- .../RntbdTransportClientTest.java | 4 +- sdk/e2e/pom.xml | 8 +- .../CHANGELOG.md | 5 +- .../README.md | 56 +- .../pom.xml | 6 +- .../checkpointstore/blob/ReadmeSamples.java | 65 + .../azure-messaging-eventhubs/CHANGELOG.md | 12 +- .../azure-messaging-eventhubs/README.md | 79 +- .../azure-messaging-eventhubs/pom.xml | 8 +- .../eventhubs/EventHubClientBuilder.java | 14 +- .../eventhubs/EventProcessorClient.java | 45 +- .../EventProcessorClientBuilder.java | 25 +- .../eventhubs/PartitionBasedLoadBalancer.java | 48 +- .../eventhubs/PartitionPumpManager.java | 206 +- .../EventHubReactorAmqpConnection.java | 8 +- .../PartitionProcessorException.java | 30 + .../eventhubs/models/CloseReason.java | 6 - .../eventhubs/models/EventPosition.java | 5 +- .../models/InitializationContext.java | 30 +- .../azure-messaging-eventhubs.properties | 2 + .../src/samples/README.md | 23 +- .../messaging/eventhubs/ConsumeEvents.java | 28 +- ...tProcessorClientAggregateEventsSample.java | 408 ++++ ...entProcessorClientJavaDocCodeSamples.java} | 2 +- ...e.java => EventProcessorClientSample.java} | 7 +- .../EventProcessorClientStateManagement.java | 105 + .../PublishEventsToSpecificPartition.java | 28 +- .../PublishEventsWithAzureIdentity.java | 72 +- .../PublishEventsWithWebSocketsAndProxy.java | 80 + .../eventhubs/PublishStreamOfEvents.java | 234 +++ .../messaging/eventhubs/ReadmeSamples.java | 179 ++ .../EventPositionIntegrationTest.java | 26 - ...EventProcessorClientErrorHandlingTest.java | 307 +++ .../eventhubs/EventProcessorClientTest.java | 132 +- .../eventhubs/IntegrationTestBase.java | 5 +- .../PartitionBasedLoadBalancerTest.java | 22 +- .../implementation/CBSChannelTest.java | 21 +- .../EventHubReactorConnectionTest.java | 23 +- .../ReactorConnectionIntegrationTest.java | 14 +- sdk/identity/azure-identity/CHANGELOG.md | 2 + sdk/identity/azure-identity/README.md | 2 +- sdk/identity/azure-identity/pom.xml | 2 +- .../CHANGELOG.md | 12 + .../README.md | 6 +- .../pom.xml | 6 +- .../certificates/CertificateAsyncClient.java | 141 +- .../certificates/CertificateClient.java | 84 +- .../certificates/CertificateService.java | 15 +- .../models/AdministratorContact.java | 69 +- .../models/CertificateContact.java | 58 +- .../models/CertificateIssuer.java | 15 +- .../models/CertificateOperation.java | 49 + .../models/CertificatePolicy.java | 33 +- .../models/CertificateProperties.java | 20 +- .../models/DeletedCertificate.java | 2 +- .../models/ImportCertificateOptions.java | 12 +- .../certificates/models/IssuerProperties.java | 23 +- .../models/KeyVaultCertificateWithPolicy.java | 12 +- .../models/MergeCertificateOptions.java | 10 +- .../BackupAndRestoreOperations.java | 2 +- ...ificateAsyncClientJavaDocCodeSnippets.java | 27 +- .../CertificateClientJavaDocCodeSnippets.java | 46 +- .../keyvault/certificates/HelloWorld.java | 4 +- .../certificates/HelloWorldAsync.java | 3 +- .../keyvault/certificates/ListOperations.java | 2 +- .../certificates/ListOperationsAsync.java | 9 +- .../ManagingDeletedCertificates.java | 2 +- .../certificates/CertificateClientTest.java | 20 +- .../CertificateClientTestBase.java | 14 +- .../azure-security-keyvault-keys/CHANGELOG.md | 3 + .../azure-security-keyvault-keys/README.md | 6 +- .../azure-security-keyvault-keys/pom.xml | 4 +- .../cryptography/CryptographyAsyncClient.java | 7 + .../KeyEncryptionKeyAsyncClient.java | 10 +- .../cryptography/KeyEncryptionKeyClient.java | 4 +- .../CHANGELOG.md | 4 +- .../azure-security-keyvault-secrets/README.md | 6 +- .../azure-security-keyvault-secrets/pom.xml | 4 +- sdk/mediaservices/mgmt-v2018_07_01/pom.xml | 2 +- .../v2018_07_01/AudioAnalyzerPreset.java | 58 +- .../BuiltInStandardEncoderPreset.java | 9 +- ...ContentKeyPolicyFairPlayConfiguration.java | 32 +- ...icyFairPlayOfflineRentalConfiguration.java | 69 + ...eyPolicyFairPlayRentalAndLeaseKeyType.java | 3 + .../v2018_07_01/EncoderNamedPreset.java | 3 + .../v2018_07_01/FaceDetectorPreset.java | 28 + .../mediaservices/v2018_07_01/Job.java | 10 + .../mediaservices/v2018_07_01/JobOutput.java | 31 + .../v2018_07_01/implementation/JobImpl.java | 10 + .../v2018_07_01/implementation/JobInner.java | 30 + sdk/netapp/mgmt-v2019_10_01/pom.xml | 135 ++ .../netapp/v2019_10_01/Accounts.java | 24 + .../netapp/v2019_10_01/ActiveDirectory.java | 227 +++ .../netapp/v2019_10_01/AuthorizeRequest.java | 43 + .../netapp/v2019_10_01/CapacityPool.java | 203 ++ .../netapp/v2019_10_01/CapacityPoolPatch.java | 76 + .../v2019_10_01/CheckNameResourceTypes.java | 47 + .../netapp/v2019_10_01/Dimension.java | 69 + .../netapp/v2019_10_01/EndpointType.java | 41 + .../netapp/v2019_10_01/ExportPolicyRule.java | 200 ++ .../v2019_10_01/InAvailabilityReasonType.java | 41 + .../v2019_10_01/MetricSpecification.java | 252 +++ .../netapp/v2019_10_01/MirrorState.java | 44 + .../netapp/v2019_10_01/MountTarget.java | 96 + .../netapp/v2019_10_01/MountTargets.java | 32 + .../netapp/v2019_10_01/NetAppAccount.java | 103 + .../v2019_10_01/NetAppAccountPatch.java | 62 + .../netapp/v2019_10_01/NetAppResources.java | 45 + .../netapp/v2019_10_01/Operation.java | 40 + .../netapp/v2019_10_01/OperationDisplay.java | 121 ++ .../netapp/v2019_10_01/Operations.java | 28 + .../management/netapp/v2019_10_01/Pools.java | 56 + .../v2019_10_01/RelationshipStatus.java | 41 + .../netapp/v2019_10_01/ReplicationObject.java | 149 ++ .../v2019_10_01/ReplicationSchedule.java | 50 + .../netapp/v2019_10_01/ReplicationStatus.java | 45 + .../v2019_10_01/ResourceNameAvailability.java | 35 + .../ResourceNameAvailabilityRequest.java | 99 + .../netapp/v2019_10_01/ServiceLevel.java | 44 + .../v2019_10_01/ServiceSpecification.java | 44 + .../netapp/v2019_10_01/Snapshot.java | 182 ++ .../netapp/v2019_10_01/SnapshotPatch.java | 44 + .../netapp/v2019_10_01/Snapshots.java | 62 + .../management/netapp/v2019_10_01/Volume.java | 375 ++++ .../netapp/v2019_10_01/VolumePatch.java | 104 + .../VolumePatchPropertiesExportPolicy.java | 46 + .../VolumePropertiesDataProtection.java | 46 + .../VolumePropertiesExportPolicy.java | 46 + .../netapp/v2019_10_01/Volumes.java | 124 ++ .../implementation/AccountsImpl.java | 114 ++ .../implementation/AccountsInner.java | 719 +++++++ .../AzureNetAppFilesManagementClientImpl.java | 280 +++ .../implementation/CapacityPoolImpl.java | 186 ++ .../implementation/CapacityPoolInner.java | 108 + .../implementation/IdParsingUtils.java | 57 + .../implementation/MountTargetImpl.java | 106 + .../implementation/MountTargetInner.java | 355 ++++ .../implementation/MountTargetsImpl.java | 53 + .../implementation/MountTargetsInner.java | 170 ++ .../implementation/NetAppAccountImpl.java | 89 + .../implementation/NetAppAccountInner.java | 63 + .../implementation/NetAppManager.java | 171 ++ .../implementation/NetAppResourcesImpl.java | 55 + .../implementation/NetAppResourcesInner.java | 283 +++ .../implementation/OperationImpl.java | 48 + .../implementation/OperationInner.java | 125 ++ .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 138 ++ .../v2019_10_01/implementation/PageImpl.java | 75 + .../v2019_10_01/implementation/PoolsImpl.java | 85 + .../implementation/PoolsInner.java | 760 +++++++ .../implementation/ReplicationStatusImpl.java | 53 + .../ReplicationStatusInner.java | 151 ++ .../ResourceNameAvailabilityImpl.java | 42 + .../ResourceNameAvailabilityInner.java | 106 + .../implementation/SnapshotImpl.java | 150 ++ .../implementation/SnapshotInner.java | 95 + .../implementation/SnapshotsImpl.java | 85 + .../implementation/SnapshotsInner.java | 965 +++++++++ .../implementation/VolumeImpl.java | 303 +++ .../implementation/VolumeInner.java | 370 ++++ .../implementation/VolumesImpl.java | 122 ++ .../implementation/VolumesInner.java | 1452 ++++++++++++++ .../implementation/package-info.java | 11 + .../netapp/v2019_10_01/package-info.java | 11 + sdk/netapp/pom.mgmt.xml | 1 + sdk/policy/mgmt-v2019_09_01/pom.xml | 135 ++ .../policy/v2019_09_01/EnforcementMode.java | 41 + .../v2019_09_01/ErrorAdditionalInfo.java | 47 + .../policy/v2019_09_01/ErrorResponse.java | 93 + .../policy/v2019_09_01/Identity.java | 73 + .../ParameterDefinitionsValue.java | 123 ++ .../ParameterDefinitionsValueMetadata.java | 96 + .../policy/v2019_09_01/ParameterType.java | 56 + .../v2019_09_01/ParameterValuesValue.java | 43 + .../policy/v2019_09_01/PolicyAssignment.java | 408 ++++ .../policy/v2019_09_01/PolicyAssignments.java | 91 + .../policy/v2019_09_01/PolicyDefinition.java | 279 +++ .../v2019_09_01/PolicyDefinitionGroup.java | 148 ++ .../PolicyDefinitionReference.java | 125 ++ .../policy/v2019_09_01/PolicyDefinitions.java | 106 + .../v2019_09_01/PolicySetDefinition.java | 268 +++ .../v2019_09_01/PolicySetDefinitions.java | 106 + .../policy/v2019_09_01/PolicySku.java | 69 + .../policy/v2019_09_01/PolicyType.java | 47 + .../v2019_09_01/ResourceIdentityType.java | 53 + .../implementation/IdParsingUtils.java | 57 + .../v2019_09_01/implementation/PageImpl.java | 75 + .../implementation/PolicyAssignmentImpl.java | 219 +++ .../implementation/PolicyAssignmentInner.java | 317 +++ .../implementation/PolicyAssignmentsImpl.java | 179 ++ .../PolicyAssignmentsInner.java | 1748 +++++++++++++++++ .../implementation/PolicyClientImpl.java | 224 +++ .../implementation/PolicyDefinitionImpl.java | 164 ++ .../implementation/PolicyDefinitionInner.java | 210 ++ .../implementation/PolicyDefinitionsImpl.java | 174 ++ .../PolicyDefinitionsInner.java | 1410 +++++++++++++ .../implementation/PolicyManager.java | 123 ++ .../PolicySetDefinitionImpl.java | 167 ++ .../PolicySetDefinitionInner.java | 213 ++ .../PolicySetDefinitionsImpl.java | 174 ++ .../PolicySetDefinitionsInner.java | 1412 +++++++++++++ .../implementation/package-info.java | 11 + .../policy/v2019_09_01/package-info.java | 11 + sdk/policy/pom.mgmt.xml | 1 + .../microsoft-azure-servicebus/pom.xml | 2 +- sdk/spring/ci.yml | 43 + .../azure-storage-blob-batch/CHANGELOG.md | 11 +- .../azure-storage-blob-batch/README.md | 4 +- sdk/storage/azure-storage-blob-batch/pom.xml | 6 +- .../azure/storage/blob/batch/BlobBatch.java | 152 +- .../blob/batch/BlobBatchAsyncClient.java | 16 +- .../storage/blob/batch/BlobBatchHelper.java | 14 +- .../blob/batch/BlobBatchOperation.java | 65 + .../blob/batch/BlobBatchOperationInfo.java | 149 ++ .../azure/storage/blob/batch/APISpec.groovy | 3 + .../storage/blob/batch/BatchAPITest.groovy | 52 + ...ingbatchrequestbeforesubmissionthrows.json | 42 +- .../BatchAPITestbulkdeleteblobs.json | 218 +- .../BatchAPITestbulksetaccesstier.json | 218 +- .../BatchAPITestdeletebloballsucceed.json | 118 +- ...teblobnonesucceeddonotthrowonanyerror.json | 86 +- ...tdeleteblobnonesucceedthrowonanyerror.json | 86 +- ...teblobsomesucceeddonotthrowonanyerror.json | 102 +- ...tdeleteblobsomesucceedthrowonanyerror.json | 102 +- .../BatchAPITestemptybatch.json | 42 +- .../BatchAPITestmixedbatch.json | 42 +- .../BatchAPITestsettierallsucceed.json | 118 +- ...ettiernonesucceeddonotthrowonanyerror.json | 86 +- ...Testsettiernonesucceedthrowonanyerror.json | 86 +- ...ettiersomesucceeddonotthrowonanyerror.json | 102 +- ...Testsettiersomesucceedthrowonanyerror.json | 102 +- ...eptionthrowsblobbatchstorageexception.json | 127 ++ ...PITestsubmittingsamebatchmanytimes[0].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[10].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[11].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[12].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[13].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[14].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[15].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[16].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[17].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[18].json | 149 ++ ...ITestsubmittingsamebatchmanytimes[19].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[1].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[2].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[3].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[4].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[5].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[6].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[7].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[8].json | 149 ++ ...PITestsubmittingsamebatchmanytimes[9].json | 149 ++ .../BatchAPITesttoomanyoperationsfails.json | 58 +- .../CHANGELOG.md | 7 +- .../azure-storage-blob-cryptography/README.md | 4 +- .../azure-storage-blob-cryptography/pom.xml | 4 +- .../specialized/cryptography/APISpec.groovy | 4 + .../azure-storage-blob-nio/CHANGELOG.md | 10 + sdk/storage/azure-storage-blob-nio/README.md | 215 ++ sdk/storage/azure-storage-blob-nio/pom.xml | 269 +++ .../blob/nio/AzureFileSystemProvider.java | 11 + .../azure/storage/blob/nio/package-info.java | 7 + .../src/main/java/module-info.java | 15 + .../java.nio.file.spi.FileSystemProvider | 1 + sdk/storage/azure-storage-blob/CHANGELOG.md | 47 +- sdk/storage/azure-storage-blob/README.md | 4 +- sdk/storage/azure-storage-blob/pom.xml | 8 +- .../azure/storage/blob/BlobAsyncClient.java | 43 +- .../com/azure/storage/blob/BlobClient.java | 4 +- .../blob/implementation/util/ModelHelper.java | 5 +- .../blob/models/ParallelTransferOptions.java | 44 +- .../blob/specialized/BlobAsyncClientBase.java | 98 +- .../blob/specialized/BlobClientBase.java | 84 +- .../blob/specialized/BlobOutputStream.java | 114 +- .../blob/specialized/BlockBlobClient.java | 25 +- ...lobAsyncClientBaseJavaDocCodeSnippets.java | 21 +- .../BlobClientBaseJavaDocCodeSnippets.java | 22 + .../com/azure/storage/blob/APISpec.groovy | 4 +- .../com/azure/storage/blob/BlobAPITest.groovy | 64 + .../storage/blob/BlobOutputStreamTest.groovy | 1 - .../storage/blob/ProgressReporterTest.groovy | 2 +- .../blob/specialized/BlockBlobAPITest.groovy | 94 +- ...stdownloadfiledoesnotexistopenoptions.json | 121 ++ ...obAPITestdownloadfileexistopenoptions.json | 121 ++ ...BlobAPITestdownloadtofiledoesnotexist.json | 109 +- .../BlobAPITestdownloadtofileexists.json | 60 +- ...obAPITestdownloadtofileexistssucceeds.json | 121 ++ sdk/storage/azure-storage-common/CHANGELOG.md | 8 +- sdk/storage/azure-storage-common/pom.xml | 6 +- .../storage/common/StorageOutputStream.java | 4 +- .../azure-storage-file-datalake/CHANGELOG.md | 10 +- .../azure-storage-file-datalake/README.md | 4 +- .../azure-storage-file-datalake/pom.xml | 8 +- .../storage/file/datalake/APISpec.groovy | 3 + .../azure-storage-file-share/CHANGELOG.md | 16 +- .../azure-storage-file-share/README.md | 4 +- sdk/storage/azure-storage-file-share/pom.xml | 8 +- .../azure/storage/file/share/APISpec.groovy | 4 +- sdk/storage/azure-storage-queue/CHANGELOG.md | 16 +- sdk/storage/azure-storage-queue/README.md | 4 +- sdk/storage/azure-storage-queue/pom.xml | 8 +- .../com/azure/storage/queue/APISpec.groovy | 3 + sdk/template/azure-sdk-template/CHANGELOG.md | 14 + sdk/template/azure-sdk-template/pom.xml | 2 +- .../azure-ai-textanalytics/CHANGELOG.md | 14 + .../azure-ai-textanalytics/README.md | 389 ++++ .../azure-ai-textanalytics/pom.xml | 68 + .../AnalyzeSentimentAsyncClient.java | 159 ++ .../DetectLanguageAsyncClient.java | 124 ++ .../ExtractKeyPhraseAsyncClient.java | 110 ++ .../RecognizeEntityAsyncClient.java | 114 ++ .../RecognizeLinkedEntityAsyncClient.java | 127 ++ .../RecognizePiiEntityAsyncClient.java | 113 ++ .../TextAnalyticsAsyncClient.java | 901 +++++++++ .../ai/textanalytics/TextAnalyticsClient.java | 669 +++++++ .../TextAnalyticsClientBuilder.java | 367 ++++ .../TextAnalyticsServiceVersion.java | 37 + .../azure/ai/textanalytics/Transforms.java | 107 + .../TextAnalyticsClientImpl.java | 328 ++++ .../TextAnalyticsClientImplBuilder.java | 66 + .../models/DetectedLanguage.java | 100 + .../models/DocumentEntities.java | 96 + .../implementation/models/DocumentError.java | 66 + .../models/DocumentKeyPhrases.java | 101 + .../models/DocumentLanguage.java | 96 + .../models/DocumentLinkedEntities.java | 98 + .../models/DocumentSentiment.java | 154 ++ .../models/DocumentSentimentValue.java | 65 + .../models/DocumentStatistics.java | 71 + .../implementation/models/EntitiesResult.java | 121 ++ .../implementation/models/Entity.java | 178 ++ .../models/EntityLinkingResult.java | 121 ++ .../implementation/models/ErrorCodeValue.java | 65 + .../implementation/models/ErrorException.java | 39 + .../implementation/models/InnerError.java | 156 ++ .../models/InnerErrorCodeValue.java | 90 + .../models/KeyPhraseResult.java | 121 ++ .../models/LanguageBatchInput.java | 41 + .../implementation/models/LanguageInput.java | 92 + .../implementation/models/LanguageResult.java | 121 ++ .../implementation/models/LinkedEntity.java | 177 ++ .../implementation/models/Match.java | 125 ++ .../models/MultiLanguageBatchInput.java | 43 + .../models/MultiLanguageInput.java | 98 + .../models/RequestStatistics.java | 131 ++ .../models/SentenceSentiment.java | 153 ++ .../models/SentenceSentimentValue.java | 60 + .../SentimentConfidenceScorePerLabel.java | 93 + .../models/SentimentResponse.java | 121 ++ .../models/TextAnalyticsError.java | 154 ++ .../models/TextAnalyticsErrorException.java | 39 + .../implementation/models/package-info.java | 16 + .../implementation/package-info.java | 17 + .../models/AnalyzeSentimentResult.java | 52 + .../models/DetectLanguageInput.java | 83 + .../models/DetectLanguageResult.java | 51 + .../models/DetectedLanguage.java | 73 + .../textanalytics/models/DocumentResult.java | 67 + .../models/DocumentResultCollection.java | 50 + .../textanalytics/models/ErrorCodeValue.java | 71 + .../models/ExtractKeyPhraseResult.java | 40 + .../ai/textanalytics/models/InnerError.java | 90 + .../ai/textanalytics/models/LinkedEntity.java | 121 ++ .../models/LinkedEntityMatch.java | 88 + .../ai/textanalytics/models/NamedEntity.java | 119 ++ .../models/RecognizeEntitiesResult.java | 40 + .../models/RecognizeLinkedEntitiesResult.java | 40 + .../models/RecognizePiiEntitiesResult.java | 40 + .../models/TextAnalyticsClientOptions.java | 55 + .../models/TextAnalyticsError.java | 91 + .../models/TextAnalyticsRequestOptions.java | 57 + .../models/TextDocumentBatchStatistics.java | 94 + .../models/TextDocumentInput.java | 88 + .../models/TextDocumentStatistics.java | 54 + .../textanalytics/models/TextSentiment.java | 93 + .../models/TextSentimentClass.java | 69 + .../ai/textanalytics/models/package-info.java | 16 + .../azure/ai/textanalytics/package-info.java | 7 + .../src/main/java/module-info.java | 14 + .../azure-ai-textanalytics.properties | 2 + .../src/samples/README.md | 69 + .../ai/textanalytics/AnalyzeSentiment.java | 47 + .../textanalytics/AnalyzeSentimentAsync.java | 59 + .../ai/textanalytics/DetectLanguage.java | 42 + .../ai/textanalytics/DetectLanguageAsync.java | 52 + .../ai/textanalytics/ExtractKeyPhrases.java | 29 + .../textanalytics/ExtractKeyPhrasesAsync.java | 44 + .../azure/ai/textanalytics/HelloWorld.java | 42 + .../ai/textanalytics/HelloWorldAsync.java | 52 + .../azure/ai/textanalytics/ReadmeSamples.java | 164 ++ .../ai/textanalytics/RecognizeEntities.java | 38 + .../textanalytics/RecognizeEntitiesAsync.java | 53 + .../RecognizeLinkedEntities.java | 35 + .../RecognizeLinkedEntitiesAsync.java | 49 + .../azure/ai/textanalytics/RecognizePii.java | 38 + .../ai/textanalytics/RecognizePiiAsync.java | 54 + ...alyticsAsyncClientJavaDocCodeSnippets.java | 27 + ...extAnalyticsClientJavaDocCodeSnippets.java | 27 + .../batch/AnalyzeSentimentBatchDocuments.java | 85 + .../AnalyzeSentimentBatchDocumentsAsync.java | 97 + .../batch/DetectLanguageBatchDocuments.java | 79 + .../DetectLanguageBatchDocumentsAsync.java | 91 + .../ExtractKeyPhrasesBatchDocuments.java | 69 + .../ExtractKeyPhrasesBatchDocumentsAsync.java | 82 + .../RecognizeEntitiesBatchDocuments.java | 77 + .../RecognizeEntitiesBatchDocumentsAsync.java | 89 + ...RecognizeLinkedEntitiesBatchDocuments.java | 73 + ...nizeLinkedEntitiesBatchDocumentsAsync.java | 86 + .../batch/RecognizePiiBatchDocuments.java | 77 + .../RecognizePiiBatchDocumentsAsync.java | 90 + .../TextAnalyticsAsyncClientTest.java | 470 +++++ .../TextAnalyticsClientTest.java | 392 ++++ .../TextAnalyticsClientTestBase.java | 1012 ++++++++++ .../analyseSentimentForBatchInput.json | 27 + ...eSentimentForBatchInputShowStatistics.json | 27 + .../analyseSentimentForBatchStringInput.json | 27 + .../analyseSentimentForEmptyText.json | 26 + .../analyseSentimentForFaultyText.json | 4 + .../analyseSentimentForListLanguageHint.json | 27 + .../analyseSentimentForTextInput.json | 27 + .../session-records/detectLanguage.json | 27 + .../detectLanguageDuplicateIdInput.json | 26 + .../detectLanguageEmptyText.json | 27 + .../detectLanguageFaultyText.json | 27 + .../detectLanguageInvalidCountryHint.json | 27 + .../detectLanguageNullText.json | 4 + .../detectLanguagesBatchInput.json | 27 + ...tectLanguagesBatchInputShowStatistics.json | 27 + ...tLanguagesBatchInputShowStatisticsNew.json | 27 + .../detectLanguagesBatchListCountryHint.json | 27 + .../detectLanguagesBatchStringInput.json | 27 + .../detectLanguagesBatchStringList.json | 27 + .../detectLanguagesNullInput.json | 26 + .../detectSingleTextLanguage.json | 27 + .../extractKeyPhrasesForBatchInput.json | 27 + ...KeyPhrasesForBatchInputShowStatistics.json | 27 + .../extractKeyPhrasesForBatchStringInput.json | 27 + .../extractKeyPhrasesForEmptyText.json | 27 + .../extractKeyPhrasesForFaultyText.json | 27 + .../extractKeyPhrasesForListLanguageHint.json | 27 + .../extractKeyPhrasesForTextInput.json | 27 + .../recognizeEntitiesForBatchInput.json | 27 + ...zeEntitiesForBatchInputShowStatistics.json | 27 + ...ognizeEntitiesForBatchListCountryHint.json | 4 + .../recognizeEntitiesForBatchStringInput.json | 27 + .../recognizeEntitiesForEmptyText.json | 26 + .../recognizeEntitiesForFaultyText.json | 27 + .../recognizeEntitiesForListLanguageHint.json | 27 + .../recognizeEntitiesForSimpleInput.json | 4 + .../recognizeEntitiesForTextInput.json | 27 + .../recognizeLinkedEntitiesForBatchInput.json | 27 + ...edEntitiesForBatchInputShowStatistics.json | 27 + ...nizeLinkedEntitiesForBatchStringInput.json | 27 + .../recognizeLinkedEntitiesForEmptyText.json | 26 + .../recognizeLinkedEntitiesForFaultyText.json | 27 + ...nizeLinkedEntitiesForListLanguageHint.json | 27 + .../recognizeLinkedEntitiesForTextInput.json | 27 + .../recognizePiiEntitiesForBatchInput.json | 27 + ...iiEntitiesForBatchInputShowStatistics.json | 27 + ...cognizePiiEntitiesForBatchStringInput.json | 27 + .../recognizePiiEntitiesForEmptyText.json | 26 + .../recognizePiiEntitiesForFaultyText.json | 27 + ...cognizePiiEntitiesForListLanguageHint.json | 27 + .../recognizePiiEntitiesForSimpleInput.json | 4 + .../recognizePiiEntitiesForTextInput.json | 27 + .../azure-ai-textanalytics/swagger/README.md | 33 + sdk/textanalytics/tests.yml | 13 + 571 files changed, 45340 insertions(+), 3152 deletions(-) create mode 100644 eng/docgeneration/Generate-DocIndex.ps1 delete mode 100644 eng/versioning/version_client_java_files.txt create mode 100644 packages.md create mode 100644 sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ReadmeSamples.java rename sdk/authorization/microsoft-azure-authentication-msi-token-provider/{readme.md => README.md} (100%) rename sdk/batch/microsoft-azure-batch/{changelog.md => CHANGELOG.md} (96%) create mode 100644 sdk/core/azure-core-amqp/CHANGELOG.md create mode 100644 sdk/core/azure-core-http-netty/CHANGELOG.md create mode 100644 sdk/core/azure-core-http-okhttp/CHANGELOG.md create mode 100644 sdk/core/azure-core-management/CHANGELOG.md create mode 100644 sdk/core/azure-core-test/CHANGELOG.md delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/implementation/LogLevel.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/logging/LogLevel.java create mode 100644 sdk/core/azure-core/src/main/resources/logging.properties create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/ReadmeSamples.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionProcessorException.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/main/resources/azure-messaging-eventhubs.properties create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientAggregateEventsSample.java rename sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/{EventProcessorJavaDocCodeSamples.java => EventProcessorClientJavaDocCodeSamples.java} (96%) rename sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/{EventProcessorSample.java => EventProcessorClientSample.java} (96%) create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientStateManagement.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithWebSocketsAndProxy.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishStreamOfEvents.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ReadmeSamples.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientErrorHandlingTest.java create mode 100644 sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayOfflineRentalConfiguration.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/pom.xml create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Accounts.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ActiveDirectory.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/AuthorizeRequest.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPool.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPoolPatch.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CheckNameResourceTypes.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Dimension.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/EndpointType.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ExportPolicyRule.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/InAvailabilityReasonType.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MetricSpecification.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MirrorState.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTarget.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTargets.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccount.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccountPatch.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppResources.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operation.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/OperationDisplay.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operations.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Pools.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/RelationshipStatus.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationObject.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationSchedule.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationStatus.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailability.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailabilityRequest.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceLevel.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceSpecification.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshot.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/SnapshotPatch.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshots.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volume.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatch.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatchPropertiesExportPolicy.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesDataProtection.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesExportPolicy.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volumes.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AzureNetAppFilesManagementClientImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/IdParsingUtils.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppManager.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PageImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesImpl.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesInner.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/package-info.java create mode 100644 sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/package-info.java create mode 100644 sdk/policy/mgmt-v2019_09_01/pom.xml create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/EnforcementMode.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorAdditionalInfo.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorResponse.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/Identity.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValue.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValueMetadata.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterType.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterValuesValue.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignment.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignments.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinition.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionGroup.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionReference.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitions.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinition.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinitions.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySku.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyType.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ResourceIdentityType.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/IdParsingUtils.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PageImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentInner.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsInner.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyClientImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionInner.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsInner.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyManager.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionInner.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsImpl.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsInner.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/package-info.java create mode 100644 sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/package-info.java create mode 100644 sdk/spring/ci.yml create mode 100644 sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperation.java create mode 100644 sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperationInfo.java create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsingleoperationexceptionthrowsblobbatchstorageexception.json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[0].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[10].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[11].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[12].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[13].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[14].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[15].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[16].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[17].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[18].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[19].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[1].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[2].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[3].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[4].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[5].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[6].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[7].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[8].json create mode 100644 sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[9].json create mode 100644 sdk/storage/azure-storage-blob-nio/CHANGELOG.md create mode 100644 sdk/storage/azure-storage-blob-nio/README.md create mode 100644 sdk/storage/azure-storage-blob-nio/pom.xml create mode 100644 sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java create mode 100644 sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/package-info.java create mode 100644 sdk/storage/azure-storage-blob-nio/src/main/java/module-info.java create mode 100644 sdk/storage/azure-storage-blob-nio/src/main/resources/META_INF/services/java.nio.file.spi.FileSystemProvider create mode 100644 sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json create mode 100644 sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json create mode 100644 sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json create mode 100644 sdk/template/azure-sdk-template/CHANGELOG.md create mode 100644 sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md create mode 100644 sdk/textanalytics/azure-ai-textanalytics/README.md create mode 100644 sdk/textanalytics/azure-ai-textanalytics/pom.xml create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/Transforms.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorException.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageInput.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectedLanguage.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResultCollection.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ErrorCodeValue.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/InnerError.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/NamedEntity.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsClientOptions.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsError.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentBatchStatistics.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentInput.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentStatistics.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentiment.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentimentClass.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/package-info.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/package-info.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/module-info.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/resources/azure-ai-textanalytics.properties create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentiment.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguage.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguageAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrases.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrasesAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorld.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorldAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntities.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntitiesAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePii.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocumentsAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocuments.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocumentsAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocumentsAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocuments.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocumentsAsync.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInputShowStatistics.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchStringInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForEmptyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForFaultyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForListLanguageHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForTextInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguage.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNullText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesNullInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchListCountryHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForSimpleInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchStringInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForSimpleInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/swagger/README.md create mode 100644 sdk/textanalytics/tests.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5a1caa588043..34f244833da3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -6,33 +6,34 @@ ########### # Catch all -/sdk/ @joshfree @jonathangiles +/sdk/ @joshfree @jonathangiles # Service teams -/sdk/appconfiguration/ @mssfang @alzimmermsft @conniey @sima-zhu -/sdk/batch/ @xingwu1 @bgklein @matthchr -/sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar -/sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar -/sdk/eventhubs/ @conniey @srnagar @mssfang -/sdk/identity/ @jianghaolu @g2vinay @hemanttanwar -/sdk/keyvault/ @g2vinay @samvaity -/sdk/servicebus/ @yvgopal @nemakam -/sdk/tracing/ @samvaity @alzimmermsft +/sdk/appconfiguration/ @mssfang @alzimmermsft @conniey @sima-zhu +/sdk/batch/ @xingwu1 @bgklein @matthchr +/sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar +/sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar +/sdk/eventhubs/ @conniey @srnagar @mssfang +/sdk/identity/ @jianghaolu @g2vinay @hemanttanwar +/sdk/keyvault/ @g2vinay @samvaity +/sdk/servicebus/ @yvgopal @nemakam +/sdk/textanalytics/ @samvaity @mssfang +/sdk/tracing/ @samvaity @alzimmermsft -/sdk/storage/ @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu +/sdk/storage/ @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu # Management Plane -/**/resource-manager/ @yaohaizh -/sdk/**/azure-mgmt-*/ @yaohaizh +/**/resource-manager/ @yaohaizh +/sdk/**/azure-mgmt-*/ @yaohaizh ########### # Eng Sys ########### -/eng/ @JimSuplizio @mitchdenny @weshaggard @danieljurek -/eng/code-quality-reports/ @mssfang @JonathanGiles -/eng/jacoco-test-coverage/ @srnagar @JonathanGiles -/eng/spotbugs-aggregate-report/ @srnagar @JonathanGiles -/parent/ @JimSuplizio +/eng/ @JimSuplizio @mitchdenny @weshaggard @danieljurek +/eng/code-quality-reports/ @mssfang @JonathanGiles +/eng/jacoco-test-coverage/ @srnagar @JonathanGiles +/eng/spotbugs-aggregate-report/ @srnagar @JonathanGiles +/parent/ @JimSuplizio -/**/tests.yml @danieljurek -/**/ci.yml @mitchdenny +/**/tests.yml @danieljurek +/**/ci.yml @mitchdenny diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e515e4862e4..152f0fc25560 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,24 +87,23 @@ The dependency-version should be set to the most recent released version and the `com.azure:azure-identity;1.0.0-preview.4;1.0.0-preview.5` -Note: In the case of a new or unreleased artifact both versions will be the same. +Note: In the case of a new artifact both versions will be the same. In the case of a released artifact, the dependecny version should be the latest released version. ### Libraries vs External Dependencies Libraries refer to things that are built and released as part of the Azure SDK. Libraries have a current version and a dependency version. -External Dependencies refer to dependencies for things that are not built and released as part of the Azure SDK regardless of the source. External Dependencies will only ever have one version. +External Dependencies refer to dependencies for things that are not built and released as part of the Azure SDK regardless of the source. External Dependencies will only ever have a dependency version. -### Current version vs Dependency version +### Current version, Dependency version and Unreleased Dependency version Current version - This is the version we should be using when defining a component in its POM file and also when dependent components are built within the same pipeline. The current version is the version currently in development. -Dependency version - This is the version we should be using when a given library is a dependency outside of a particular area. This should be the latest released version of the package. +Dependency version - This is the version we should be using when a given library is a dependency outside of a particular area. This should be the latest released version of the package whenever possible. +Unreleased Dependency version – Whenever possible, libraries should be using the latest released version for dependencies but there is the case where active development in one library is going to be needed by another library or libraries that are built in separate pipelines. These types of changes are specifically additive and not breaking. Once a library has GA’d, nothing short of breaking changes should ever force the dependency versions across the repo to an unreleased version. The reason for this is that it would prevent other libraries, that don’t need this change, from releasing. -For example: `com.azure:azure-storage-blob-batch` has dependencies on `com.azure:azure-core`, `com.azure:azure-core-http-netty` and `com.azure:azure-storage-blob`. Because `com.azure:azure-core` and `com.azure:azure-core-http-netty` are both built outside of azure-storage pipeline we should be using the released or *Dependency* versions of these when they're dependencies of another library. Similarly, libraries built as part of the same pipeline, that have interdependencies, should be using the Current version. Since `com.azure:azure-storage-blob-batch` and `com.azure:azure-storage-blob` are both built part of the azure-batch pipeline when `com.azure:azure-storage-blob` is declared as a dependency of `com.azure:azure-storage-blob-batch` it should be the *Current* version. +An example of Current vs Dependency versions: `com.azure:azure-storage-blob-batch` has dependencies on `com.azure:azure-core`, `com.azure:azure-core-http-netty` and `com.azure:azure-storage-blob`. Because `com.azure:azure-core` and `com.azure:azure-core-http-netty` are both built outside of azure-storage pipeline we should be using the released or *Dependency* versions of these when they're dependencies of another library. Similarly, libraries built as part of the same pipeline, that have interdependencies, should be using the Current version. Since `com.azure:azure-storage-blob-batch` and `com.azure:azure-storage-blob` are both built part of the azure-batch pipeline when `com.azure:azure-storage-blob` is declared as a dependency of `com.azure:azure-storage-blob-batch` it should be the *Current* version. -This is going to be especially important after GA when releases aren't going to be the entire Azure SDK every time. If we're releasing a patch for a targeted azure-storage fix then we shouldn't need to build and release azure-core, we should be targeting the released versions and only building/releasing that update to azure-storage. It's worth noting that right now, in the version_client.txt, the dependency/current versions are the same. This will change once we GA, at which point the current version should be ahead of the dependency version. - -What about README files? Right now the README files in the repo end up getting into an odd state since things like samples and versions can get updated during the development process. We're in the process of versioning documentation with the releases which means that the docs are snapshot at the time of the release and then versioned and stored. This will allow the README files in the repo to have updated samples and versions that are setup for the next release. +An example of an Unreleased Dependency version: Additive, not breaking, API changes have been made to `com.azure:azure-core`. `com.azure:azure-storage-blob` has a dependency on `com.azure:azure-core` and requires the additive API change that has not yet been released. An unreleased entry needs to be created in [version_client.txt](./eng/versioning/version_client.txt), under the unreleased section, with the following format: `unreleased_:;dependency-version`, in this example that would be `unreleased_com.azure:azure-core;1.2.0` (this should match the 'current' version of core). The dependency update tags in the pom files that required this dependency would now reference `{x-version-update;unreleased_com.azure:azure-core;dependency}`. Once the updated library has been released the unreleased dependency version should be removed and the POM file update tags should be referencing the released version. ### Tooling, version files and marker tags @@ -112,6 +111,7 @@ All of the tooling lives under the **eng\versioning** directory. - version_client.txt - Contains the Client library and versions - version_data.txt - Contains Data library and versions +- external_dependencies.txt - Contains the external dependency versions - update_versions.py - This is just a basic python script that will climb through the source tree and update POM and README files. The script utilizes tags within the files to do replacements and the tags are slightly different between the POM and README files. - set_versions.py - This script should only be used by the build system when we start producing nightly ops builds. @@ -135,56 +135,31 @@ In README files this ends up being slightly different. Because the version tag i ``` [//]: # ({x-version-update-end}) -What if I've got something that, for whatever reason, shoudln't be updated? There's a tag for that. - -`` - -In theory, absence of an x-version-update tag would do the same thing but the tooling is still being developed and eventually there will be checkin blockers if xml has a version element with no tag. - ### What does the process look like? Let's say we've GA'd and I need to tick up the version of azure-storage libraries how would I do it? Guidelines for incrementing versions after release can be found [here](https://github.com/Azure/azure-sdk/blob/master/docs/policies/releases.md#incrementing-after-release). -1. I'd open up eng\versioning\version_client.txt and update the current-versions of the libraries that are built and released as part of the azure storage pipeline. This list can be found in pom.service.xml under the sdk/storage directory. It's worth noting that any module entry starting with "../" are external module dependencies and not something that's released as part of the pipeline. Once we GA, these build dependencies for library components outside of a given area should go away and be replaced with downloading the appropriate dependency from Maven like we do for external dependencies. +1. I'd open up eng\versioning\version_client.txt and update the current-versions of the libraries that are built and released as part of the azure storage pipeline. This list can be found in pom.service.xml under the sdk/storage directory. It's worth noting that any module entry starting with "../" are external module dependencies and not something that's released as part of the pipeline. Dependencies for library components outside of a given area would be downloading the appropriate dependency from Maven like we do for external dependencies. 2. Execute the update_versions python script from the root of the enlistment `python eng/versioning/update_versions.py --ut libary --bt client` This will go through the entire source tree and update all of the references in the POM and README files with the updated versions. Git status will show all of the modified files. 3. Review and submit a PR with the modified files. -### Next steps: External dependencies, Management plane and service pipeline changes +### Next steps: Management plane -- External dependencies. Right now there are only version files for client and data (eng\versioning\version_\[client|data\].txt) which only encompass the built binaries for their respective tracks. External dependencies for both client and data are next on the list which should allow modification of the parent/pom.xml to remove the list of version properties and dependency management sections which brings things one step closer to not having to publish the parent pom. - Management plane. Management is in the process of being moved to service pipeline builds. The versioning work needs to wait until that work is finished. -- Service pipeline changes. The service pipelines currently have to build not only the libraries that are part of that pipeline but also the Azure SDK libraries that are dependencies. Once we GA and can start targeting the released version of those packages and pulling them from Maven instead of building them. An good example of this would be in sdk/appconfiguration/pom.service.xml where to build azure-data-appconfiguration we end up building azure-core, azure-core-test and azure-core-http-netty along with azure-data-appconfiguration instead of just building azure-data-appconfiguration. - -### How are versioning and dependencies going to impact development after GA? - -As mentioned above, in the service pipeline changes, the plan after we GA is to start targeting the released version of the packages and pulling them from Maven. This is going to fundamentally change some aspects of the development process especially when work needs to be done on given library that requires dependency changes in one or more libraries. - -- **Scenario 1: Making changes to a single library which is not a dependency of any other libraries:** This ends up being the most straightforward scenario and really isn't much different than it is today. - - [ ] Appropriately increase the version - - [ ] Make the code changes - - [ ] Submit the PR - - [ ] Merge the PR - - [ ] Publish the new version - -- **Scenario 2: Making changes to a library that also requires dependency changes:** Right now things are in a state where dependency changes can be made along with libraries that depend on them because of the project dependencies in the service pom files. Local development isn't going to change that much except when changing the version of a library and its dependency or dependencies means that the service poms are going to have to be built, and installed, in the appropriate order. This is because these new versions of the library dependencies won't yet be released and Maven will need to find these in the local cache. The biggest change to the process is going to be around PRs and publishing. Separate PRs are going to have to be submitted in order, with dependencies being submitted first. This is necessary because the dependencies need to be published in order to allow things that depend on them to continue using the published version. Trying to submit everything in one PR would cause build breaks since the dependency being referenced is a version not yet published. An example of this would be making changes to `com.azure:azure-storage-common` that also required dependency changes to `com.azure:azure-identity`. - Changes are going to have to be made to `com.azure:azure-identity` first. - - [ ] Appropriately increase the version of `com.azure:azure-identity` - - [ ] Make the code changes - - [ ] Build and optionally install locally - This isn't completely necessary other than to install the updated version of the dependency into the local cache on the machine. The alternative to this would be to publish (DevOps or otherwise) and reference that version of the dependency after the release. Either one would allow `com.azure:azure-storage-common` to use the updated version of `com.azure:azure-identity` - - [ ] Submit the PR for the `com.azure:azure-identity` - - [ ] Merge the PR for the `com.azure:azure-identity` - - [ ] Publish the `com.azure:azure-identity` with the updated version. - - Only after the dependency `com.azure:azure-identity` has been published can the PR for `com.azure:azure-storage-common` be created. - - [ ] Appropriately increase the version of `com.azure:azure-storage-common` and the dependency version of `com.azure:azure-identity` in its pom file. - - [ ] Make the code changes, if any - - [ ] Build/Test or whatever - - [ ] Submit the PR for `com.azure:azure-storage-common` - - [ ] Merge the PR for `com.azure:azure-storage-common` - - [ ] Publish the PR for `com.azure:azure-storage-common` + +### Making changes to an already GA'd library that require other libraries to depend on the unreleased version + +This is where the `unreleased_` dependency tags come into play. Using the Unreleased Dependency example above, where `com.azure:azure-storage-blob` has a dependency on an unreleased `com.azure:azure-core`: + +- [ ] Make the additive changes to `com.azure:azure-core` +- [ ] In [version_client.txt](./eng/versioning/version_client.txt) add the entry for the unreleased azure core in the unreleased section at the bottom of the file. The entry would look like `unreleased_com.azure:azure-core;`. + Note: The version of the library referenced in the unreleased version tag should match the current version of that library. +- [ ] In the pom.xml file for `com.azure:azure-storage-blob`, the dependency tag for `com.azure:azure-core` which was originally `{x-version-update;com.azure:azure-core-test;dependency}` would now become `{x-version-update;unreleased_com.azure:azure-core-test;dependency}` +After the unreleased version of `com.azure:azure-core` was released but before `com.azure:azure-storage-blob` has been released. +- [ ] In [version_client.txt](./eng/versioning/version_client.txt) the the dependency version of `com.azure:azure-core` would become the released version and the "unreleased_" entry, at this time, would be removed. +- [ ] In the pom.xml file for `com.azure:azure-storage-blob`, the dependency tag for `com.azure:azure-core` would get changed back to `{x-version-update;com.azure:azure-core-test;dependency}` ### Nightly package builds diff --git a/README.md b/README.md index feab34484999..705e86bb6b89 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository is intended for active development of the Azure SDK for Java. Fo ### Important -The Azure SDK team is pleased to make available the November 2019 client library General Availability (GA) release. We strongly recommend using the GA libraries in all production environments as these libraries are well tested and officially supported by Microsoft. More details, including installation instructions can be found here [here](https://azure.github.io/azure-sdk/releases/2019-11/java.html). +The Azure SDK team is pleased to make available the January 2020 client library General Availability (GA) release. We strongly recommend using the GA libraries in all production environments as these libraries are well tested and officially supported by Microsoft. More details, including installation instructions can be found here [here](https://azure.github.io/azure-sdk/releases/2019-11/java.html). ## Getting started @@ -16,24 +16,28 @@ For tutorials, samples, quick starts and other documentation, visit [Azure for J ### Prerequisites -Java 8 or later is required to use the November 2019 client libraries, otherwise Java 7 or later is required. +Java 8 or later is required to use the January 2020 client libraries, otherwise Java 7 or later is required. ## Latest Release Each service might have a number of libraries available from each of the following categories: -- [Client: GA Decemeber 2019 Releases](#Client-GA-Decemeber-2019-Releases) +- [Client: GA January 2020 Releases](#Client-GA-January-2020-Releases) - [Client - Previous Versions](#Client-Previous-Versions) - [Management](#Management) -### Client: GA December 2019 Releases +### Client: GA January 2020 Releases -New wave of packages that were released in December 2019 client library as General Availability (GA) and several others that were released in **beta**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java/guidelines/) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](sdk/core/README.md). +New wave of packages that were released in January 2020 client library as General Availability (GA) and several others that were released in **beta**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java/guidelines/) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](https://github.com/Azure/azure-sdk-for-java/blob/azure-core_1.1.0/sdk/core/azure-core/README.md). These libraries can be easily identified by sdk/ folder, package, and namespaces names starting with `azure-`, e.g. `azure-keyvault`. -The libraries released in the GA December 2019 release: +The libraries released in the GA January 2020 release: +- [App Configuration](https://github.com/Azure/azure-sdk-for-java/tree/azure-data-appconfiguration_1.0.0-beta.7/sdk/appconfiguration/azure-data-appconfiguration/README.md) +- [Event Hubs](https://github.com/Azure/azure-sdk-for-java/blob/azure-messaging-eventhubs_5.0.0-beta.6/sdk/eventhubs/azure-messaging-eventhubs/README.md) +- [Event Hubs Checkpoint Store](https://github.com/Azure/azure-sdk-for-java/blob/azure-messaging-eventhubs-checkpointstore-blob_1.0.0-beta.4/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md) - [Identity](https://github.com/Azure/azure-sdk-for-java/blob/azure-identity_1.0.1/sdk/identity/azure-identity/README.md) +- [Key Vault Certificates](https://github.com/Azure/azure-sdk-for-java/blob/azure-security-keyvault-certificates_4.0.0-beta.6/sdk/keyvault/azure-security-keyvault-certificates/README.md) - [Key Vault Keys](https://github.com/Azure/azure-sdk-for-java/blob/azure-security-keyvault-keys_4.0.1/sdk/keyvault/azure-security-keyvault-keys/README.md) - [Key Vault Secrets](https://github.com/Azure/azure-sdk-for-java/blob/azure-security-keyvault-secrets_4.0.1/sdk/keyvault/azure-security-keyvault-secrets/README.md) - [Storage Blobs](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.1.0/sdk/storage/azure-storage-blob/README.md) @@ -42,13 +46,9 @@ The libraries released in the GA December 2019 release: - [Storage Queues](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-queue_12.1.0/sdk/storage/azure-storage-queue/README.md) - [Storage File Share](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-file-share_12.0.0/sdk/storage/azure-storage-file-share/README.md) -The libraries released in the December 2019 beta: -- [App Configuration](https://github.com/Azure/azure-sdk-for-java/tree/azure-data-appconfiguration_1.0.0-beta.7/sdk/appconfiguration/azure-data-appconfiguration/README.md) -- [Event Hubs](https://github.com/Azure/azure-sdk-for-java/blob/azure-messaging-eventhubs_5.0.0-beta.6/sdk/eventhubs/azure-messaging-eventhubs/README.md) -- [Event Hubs Checkpoint Store](https://github.com/Azure/azure-sdk-for-java/blob/azure-messaging-eventhubs-checkpointstore-blob_1.0.0-beta.4/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md) -- [Key Vault Certificates](https://github.com/Azure/azure-sdk-for-java/blob/azure-security-keyvault-certificates_4.0.0-beta.6/sdk/keyvault/azure-security-keyvault-certificates/README.md) -- [OpenCensus Tracing](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opencensus_1.0.0-beta.5/sdk/core/azure-core-tracing-opencensus/README.md) +The libraries released in the January 2020 beta: - [OpenTelemetry Tracing](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opentelemetry_1.0.0-beta.1/sdk/core/azure-core-tracing-opentelemetry/README.md) +- [Text Analytics](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/textanalytics/azure-ai-textanalytics/README.md) > NOTE: If you need to ensure your code is ready for production use one of the stable, non-preview libraries. @@ -71,7 +71,7 @@ Libraries which enable you to provision specific resources. They are responsible ## Navigating the repository ### Master branch -The master branch has the most recent code with new features and bug fixes. It does **not** represent latest released **GA** SDK. See [above](#Client-GA-November-2019-Releases) for latest **GA** release.
+The master branch has the most recent code with new features and bug fixes. It does **not** represent latest released **GA** SDK. See [above](#Client-GA-January-2020-Releases) for latest **GA** release.
### Release branches (Release tagging) diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 480d44a05fa6..690ec90b26cf 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -19,70 +19,114 @@ required_readme_sections: - ^Next steps$ - ^Contributing$ known_presence_issues: - - ['sdk/cognitiveservices/ms-azure-cs-spellcheck', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-luis-authoring', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-luis-runtime', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-textanalytics', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-autosuggest', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-customimagesearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-customsearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-entitysearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-imagesearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-newssearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-videosearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-visualsearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-websearch', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-computervision', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-contentmoderator', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-customvision-prediction', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-customvision-training', '#2847'] - - ['sdk/cognitiveservices/ms-azure-cs-faceapi', '#2847'] - - ['sdk/keyvault/microsoft-azure-keyvault', '#2847'] - - ['sdk/keyvault/microsoft-azure-keyvault-core', '#2847'] - - ['sdk/keyvault/microsoft-azure-keyvault-cryptography', '#2847'] - - ['sdk/keyvault/microsoft-azure-keyvault-extensions', '#2847'] - - ['sdk/keyvault/microsoft-azure-keyvault-webkey', '#2847'] - - ['sdk/mediaservices/microsoft-azure-media', '#2847'] - - ['mediaservices/data-plane', '#2847'] - - ['core/build-tools', '#2847'] - - ['sdk/core/azure-core', '#2847'] - - ['sdk/core/azure-core-auth', '#2847'] - - ['sdk/core/azure-core-management', '#2847'] - - ['cosmosdb/data-plane/commons-test-utils', '#2847'] - - ['cosmosdb/data-plane/sdk', '#2847'] - - ['sdk/cosmos/microsoft-azure-cosmos', '#2847'] - - ['cosmosdb/data-plane/gateway', '#2847'] - - ['cosmosdb/data-plane/commons', '#2847'] - - ['cosmosdb/data-plane/direct-impl', '#2847'] + - ['core/build-tools', '#2847'] + - ['cosmosdb/data-plane/commons', '#2847'] + - ['cosmosdb/data-plane/commons-test-utils', '#2847'] + - ['cosmosdb/data-plane/direct-impl', '#2847'] + - ['cosmosdb/data-plane/gateway', '#2847'] + - ['cosmosdb/data-plane/sdk', '#2847'] + - ['mediaservices/data-plane', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-autosuggest', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-computervision', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-contentmoderator', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customimagesearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customsearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customvision-prediction', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customvision-training', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-entitysearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-faceapi', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-imagesearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-luis-authoring', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-luis-runtime', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-newssearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-spellcheck', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-textanalytics', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-videosearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-visualsearch', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-websearch', '#2847'] + - ['sdk/core/azure-core', '#2847'] + - ['sdk/core/azure-core-auth', '#2847'] + - ['sdk/core/azure-core-management', '#2847'] + - ['sdk/cosmos/microsoft-azure-cosmos', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-core', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-cryptography', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-extensions', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-webkey', '#2847'] + - ['sdk/mediaservices/microsoft-azure-media', '#2847'] + - ['sdk/e2e', '#2847'] + # Changelog List + - ['sdk/applicationinsights/microsoft-azure-applicationinsights-query/CHANGELOG.md', '#2847'] + - ['sdk/authorization/microsoft-azure-authentication-msi-token-provider/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-autosuggest/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-computervision/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-contentmoderator/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customimagesearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customsearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customvision-prediction/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-customvision-training/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-entitysearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-faceapi/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-imagesearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-luis-authoring/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-luis-runtime/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-newssearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-spellcheck/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-textanalytics/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-videosearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-visualsearch/CHANGELOG.md', '#2847'] + - ['sdk/cognitiveservices/ms-azure-cs-websearch/CHANGELOG.md', '#2847'] + - ['sdk/core/azure-core/CHANGELOG.md', '#2847'] + - ['sdk/core/azure-core-amqp/CHANGELOG.md', '#2847'] + - ['sdk/core/azure-core-http-netty/CHANGELOG.md', '#2847'] + - ['sdk/core/azure-core-http-okhttp/CHANGELOG.md', '#2847'] + - ['sdk/core/azure-core-management/CHANGELOG.md', '#2847'] + - ['sdk/core/azure-core-test/CHANGELOG.md', '#2847'] + - ['sdk/cosmos/microsoft-azure-cosmos/CHANGELOG.md', '#2847'] + - ['sdk/eventgrid/microsoft-azure-eventgrid/CHANGELOG.md', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault/CHANGELOG.md', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-core/CHANGELOG.md', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-cryptography/CHANGELOG.md', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-extensions/CHANGELOG.md', '#2847'] + - ['sdk/keyvault/microsoft-azure-keyvault-webkey/CHANGELOG.md', '#2847'] + - ['sdk/loganalytics/microsoft-azure-loganalytics/CHANGELOG.md', '#2847'] + - ['sdk/mediaservices/microsoft-azure-media/CHANGELOG.md', '#2847'] + - ['sdk/e2e/CHANGELOG.md', '#2847'] + known_content_issues: - - ['sdk/template/azure-sdk-template/README.md','has other required sections'] - - ['README.md', '#3113'] - - ['sdk/applicationinsights/microsoft-azure-applicationinsights-query/README.md', '#3113'] - - ['sdk/batch/microsoft-azure-batch/README.md', '#3113'] - - ['sdk/eventgrid/microsoft-azure-eventgrid/README.md', '#3113'] - - ['sdk/eventhubs/README.md', '#3113'] - - ['eventhubs/data-plane/azure-eventhubs-eph/Readme.md', '#3113'] - - ['sdk/authorization/microsoft-azure-authentication-msi-token-provider/readme.md', '#3113'] - - ['sdk/keyvault/README.md', '#3113'] - - ['sdk/loganalytics/microsoft-azure-loganalytics/README.md', '#3113'] - - ['sdk/servicebus/README.md', '#3113'] - - ['sdk/storage/microsoft-azure-storage-blob/README.md', '#3113'] - - ['sdk/storage/microsoft-azure-storage-blob/swagger/README.md', '#3113'] - - ['sdk/storage/azure-storage-common/README.md', '#3113'] - - ['sdk/core/README.md', '#3113'] - - ['sdk/storage/README.md', '#3113'] - - ['cosmosdb/data-plane/README.md', '#3113'] - - ['cosmosdb/data-plane/benchmark/README.md', '#3113'] - - ['cosmosdb/data-plane/changelog/README.md', '#3113'] - - ['cosmosdb/data-plane/faq/README.md', '#3113'] - - ['sdk/cosmos/faq/README.md', '#3113'] - - ['sdk/cosmos/changelog/README.md', '#3113'] - - ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113'] - - ['sdk/cosmos/README.md', '#3113'] - - ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113'] - - ['sdk/storage/azure-storage-file-datalake/swagger/README.md', '#3113'] - - ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113'] - - ['sdk/storage/azure-storage-file-share/swagger/README.md', '#3113'] + - ['cosmosdb/data-plane/benchmark/README.md', '#3113'] + - ['cosmosdb/data-plane/changelog/README.md', '#3113'] + - ['cosmosdb/data-plane/faq/README.md', '#3113'] + - ['cosmosdb/data-plane/README.md', '#3113'] + - ['eventhubs/data-plane/azure-eventhubs-eph/Readme.md', '#3113'] + - ['README.md', '#3113'] + - ['sdk/applicationinsights/microsoft-azure-applicationinsights-query/README.md', '#3113'] + - ['sdk/authorization/microsoft-azure-authentication-msi-token-provider/README.md', '#3113'] + - ['sdk/batch/microsoft-azure-batch/README.md', '#3113'] + - ['sdk/core/README.md', '#3113'] + - ['sdk/cosmos/changelog/README.md', '#3113'] + - ['sdk/cosmos/faq/README.md', '#3113'] + - ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113'] + - ['sdk/cosmos/README.md', '#3113'] + - ['sdk/eventgrid/microsoft-azure-eventgrid/README.md', '#3113'] + - ['sdk/eventhubs/microsoft-azure-eventhubs-eph/Readme.md', '#3113'] + - ['sdk/eventhubs/README.md', '#3113'] + - ['sdk/keyvault/README.md', '#3113'] + - ['sdk/loganalytics/microsoft-azure-loganalytics/README.md', '#3113'] + - ['sdk/servicebus/README.md', '#3113'] + - ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-common/README.md', '#3113'] + - ['sdk/storage/azure-storage-file/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-file-datalake/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113'] + - ['sdk/storage/microsoft-azure-storage-blob/README.md', '#3113'] + - ['sdk/storage/microsoft-azure-storage-blob/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-blob-nio/README.md', '#3113'] + - ['sdk/storage/README.md', '#3113'] + - ['sdk/textanalytics/azure-ai-textanalytics/swagger/README.md', '#3113'] + - ['sdk/template/azure-sdk-template/README.md','has other required sections'] + - ['sdk/storage/azure-storage-file-share/swagger/README.md','has other required sections'] + package_indexing_exclusion_list: - azure-loganalytics-sample - azure-applicationinsights-query-sample diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 7621885dcc95..5c4752c84813 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -261,4 +261,15 @@ + + + + + + + + + + + diff --git a/eng/docgeneration/Generate-DocIndex.ps1 b/eng/docgeneration/Generate-DocIndex.ps1 new file mode 100644 index 000000000000..a5a7466c58fc --- /dev/null +++ b/eng/docgeneration/Generate-DocIndex.ps1 @@ -0,0 +1,164 @@ +[CmdletBinding()] +Param ( + $RepoRoot, + $DocGenDir +) + +Write-Verbose "Name Reccuring paths with variable names" +$DocFxTool = "${RepoRoot}/docfx/docfx.exe" +$DocOutDir = "${RepoRoot}/docfx_project" + +Write-Verbose "Initializing Default DocFx Site..." +& "${DocFxTool}" init -q -o "${DocOutDir}" + +Write-Verbose "Copying template and configuration..." +New-Item -Path "${DocOutDir}" -Name "templates" -ItemType "directory" +Copy-Item "${DocGenDir}/templates/*" -Destination "${DocOutDir}/templates" -Force -Recurse +Copy-Item "${DocGenDir}/docfx.json" -Destination "${DocOutDir}/" -Force + +Write-Verbose "Creating Index using service directory and package names from repo..." +# The service mapper is used to map the directory names to the service names to produce +# a more friendly index. If something isn't in the mapper then the default will just be +# the service name in all caps +$serviceMapHash = Get-Content -Path "${DocGenDir}/service-mapper.json" | ConvertFrom-Json -AsHashtable + +# There are some artifact that show up, due to the way we do discovery, that are never shipped. +# Keep a list of those here and anything we don't want to ship can be added to here which will +# cause them to get skipped when generating the DocIndex +$ArtifactsToSkip = ( +'azure-cosmos-benchmark', +'azure-sdk-template' +) + +# The list of services is being constructed from the directory list under the sdk folder +# which, right now, only contains client/data directories. When management is moved to +# the under sdk it'll automatically get picked up. +$ServiceListData = Get-ChildItem "${RepoRoot}/sdk" -Directory +$YmlPath = "${DocOutDir}/api" +New-Item -Path $YmlPath -Name "toc.yml" -Force +foreach ($Dir in $ServiceListData) +{ + $mappedDir = "" + if ($serviceMapHash.ContainsKey($Dir.Name)) + { + $mappedDir = $serviceMapHash[$Dir.Name] + } + else + { + $mappedDir = $Dir.Name.ToUpper() + } + + # Store the list of artifacts into the arrays and write them into the .md file + # after processing the list of subdirectories. This will allow the correct + # division of the artifacts under the Client or Management headings + $clientArr = @() + $mgmtArr = @() + + $PkgList = Get-ChildItem $Dir.FullName -Directory -Exclude changelog, faq, .github, build + if (($PkgList | Measure-Object).count -eq 0) + { + continue + } + foreach ($Pkg in $PkgList) + { + # Load the pom file to pull the artifact name and grab the + # parent's relative path to see which parent pom is being + # used to determine whether or not the artifact is client + # or management. + $PomPath = Join-Path -Path $Pkg -ChildPath "pom.xml" + + # no pom file = nothing to process + if (Test-Path -path $PomPath) + { + $xml = New-Object xml + $xml.Load($PomPath) + + # Get the artifactId from the POM + $artifactId = $xml.project.artifactId + + $parent = $xml.project.parent.relativePath + + # If this is an artifact that isn't shipping then just + # move on to the next one + if ($ArtifactsToSkip -contains $artifactId) + { + Write-Output "skipping $artifactId" + continue + } + + # If the parent is null or empty then the pom isn't directly including + # one of the pom.[client|data|management].xml and needs to be specially + # handled + if (("" -eq $parent) -or ($null -eq $parent)) + { + # Cosmos has a root pom which includes pom.client.xml that won't + # be detected by this logic. It's easier to deal with specially + # than it is to try and climb the pom chain here. + if ($Dir.BaseName -eq 'cosmos') + { + $clientArr += $artifactId + } + else + { + Write-Host "*snowflake* Pom $PomPath, has a null or empty relative path." + } + } + else + { + if (($parent.IndexOf('pom.client.xml') -ne -1) -or ($parent.IndexOf('pom.data.xml') -ne -1)) + { + $clientArr += $artifactId + } + else + { + $mgmtArr += $artifactId + } + } + } + } + # Only create this if there's something to create + #if (($clientArr.Count -gt 0) -or ($mgmtArr.Count -gt 0)) + if ($clientArr.Count -gt 0) + { + New-Item -Path $YmlPath -Name "$($Dir.Name).md" -Force + Add-Content -Path "$($YmlPath)/toc.yml" -Value "- name: $($mappedDir)`r`n href: $($Dir.Name).md" + # loop through the arrays and add the appropriate artifacts under the appropriate headings + if ($clientArr.Count -gt 0) + { + Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "# Client Libraries" + foreach($lib in $clientArr) + { + Write-Host "Write $($lib) to $($Dir.Name).md" + Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "#### $lib" + } + } + # For the moment there are no management docs and with the way some of the libraries + # in management are versioned is a bit wonky. They aren't versioned by releasing a new + # version with the same groupId/artifactId, they're versioned with the same artifactId + # and version with a different groupId and the groupId happens to include the date. For + # example, the artifact/version of azure-mgmt-storage:1.0.0-beta has several different + # groupIds. com.microsoft.azure.storage.v2016_01_01, com.microsoft.azure.storage.v2017_10_01, + # com.microsoft.azure.storage.v2018_11_01 etc. + #if ($mgmtArr.Count -gt 0) + #{ + # Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "# Management Libraries" + # foreach($lib in $mgmtArr) + # { + # Write-Output "Write $($lib) to $($Dir.Name).md" + # Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "#### $lib" + # } + #} + } +} + +Write-Verbose "Creating Site Title and Navigation..." +New-Item -Path "${DocOutDir}" -Name "toc.yml" -Force +Add-Content -Path "${DocOutDir}/toc.yml" -Value "- name: Azure SDK for Java APIs`r`n href: api/`r`n homepage: api/index.md" + +Write-Verbose "Copying root markdowns" +Copy-Item "$($RepoRoot)/README.md" -Destination "${DocOutDir}/api/index.md" -Force + +Write-Verbose "Building site..." +& "${DocFxTool}" build "${DocOutDir}/docfx.json" + +Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force \ No newline at end of file diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index 10eeb49f1126..6def9ea42ddf 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -36,25 +36,30 @@ + + com.azure + azure-ai-textanalytics + 1.0.0-beta.1 + com.azure azure-core - 1.2.0-beta.1 + 1.2.0 com.azure azure-core-amqp - 1.0.0-beta.9 + 1.0.1 com.azure azure-core-http-netty - 1.2.0-beta.1 + 1.2.0 com.azure azure-core-http-okhttp - 1.1.0-beta.1 + 1.1.0 @@ -65,7 +70,7 @@ - + com.azure @@ -75,7 +80,7 @@ com.azure azure-data-appconfiguration - 1.0.0-beta.8 + 1.0.1 com.azure @@ -85,7 +90,7 @@ com.azure azure-security-keyvault-certificates - 4.0.0-beta.7 + 4.0.0-beta.8 com.azure @@ -100,22 +105,22 @@ com.azure azure-messaging-eventhubs - 5.0.0-beta.7 + 5.0.1 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.0.0-beta.5 + 1.0.1 com.azure azure-storage-common - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure azure-storage-blob - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure @@ -127,20 +132,25 @@ azure-storage-blob-cryptography 12.2.0-beta.1 + + com.azure + azure-storage-blob-nio + 12.0.0-beta.1 + com.azure azure-storage-file-share - 12.1.0-beta.1 + 12.1.0-beta.2 com.azure azure-storage-file-datalake - 12.0.0-beta.8 + 12.0.0-beta.9 com.azure azure-storage-queue - 12.2.0-beta.1 + 12.2.0-beta.2 diff --git a/eng/pipelines/docindex.yml b/eng/pipelines/docindex.yml index b2b466605894..142c331cb676 100644 --- a/eng/pipelines/docindex.yml +++ b/eng/pipelines/docindex.yml @@ -13,177 +13,28 @@ jobs: pool: vmImage: windows-2019 steps: + - task: UsePythonVersion@0 + displayName: 'Use Python 3.6' + inputs: + versionSpec: '3.6' + + - template: eng/pipelines/templates/scripts/replace-relative-links.yml@azure-sdk-tools + parameters: + TargetFolder: . + RootFolder: . + BuildSHA: $(Build.SourceVersion) + RepoId: 'Azure/azure-sdk-for-java' + - pwsh: | Invoke-WebRequest -Uri "https://github.com/dotnet/docfx/releases/download/v2.43.2/docfx.zip" ` -OutFile "docfx.zip" | Wait-Process; Expand-Archive -Path "docfx.zip" -DestinationPath "./docfx/" - workingDirectory: $(Build.BinariesDirectory) + workingDirectory: $(Build.SourcesDirectory) displayName: Download and Extract DocFX - - task: CmdLine@2 - displayName: Provision DocFX Directory - inputs: - script: $(Build.BinariesDirectory)/docfx/docfx.exe init -q - workingDirectory: $(Build.SourcesDirectory) - failOnStderr: true - - pwsh: New-Item -Path . -Name "templates" -ItemType "directory" - displayName: Create Template Directory - workingDirectory: $(Build.SourcesDirectory)/docfx_project/ - - task: CopyFiles@2 - displayName: Copy Template to templates folder - inputs: - sourceFolder: $(Build.SourcesDirectory)/eng/docgeneration/templates - content: '**\*' - targetFolder: $(Build.SourcesDirectory)/docfx_project/templates - overWrite: true - - pwsh: ls - workingDirectory: $(Build.SourcesDirectory)/docfx_project/ - - pwsh: ls - workingDirectory: $(Build.SourcesDirectory)/docfx_project/templates - - pwsh: | - Copy-Item "$(Build.SourcesDirectory)/eng/docgeneration/docfx.json" -Destination "$(Build.SourcesDirectory)/docfx_project/" -Force - displayName: Copy over docfx.json - - pwsh: | - - # The service mapper is used to map the directory names to the service names to produce - # a more friendly index. If something isn't in the mapper then the default will just be - # the service name in all caps - $serviceMapHash = Get-Content -Path "$(Build.SourcesDirectory)/eng/docgeneration/service-mapper.json" | ConvertFrom-Json -AsHashtable - - # There are some artifact that show up, due to the way we do discovery, that are never shipped. - # Keep a list of those here and anything we don't want to ship can be added to here which will - # cause them to get skipped when generating the DocIndex - $ArtifactsToSkip = ( - 'azure-cosmos-benchmark', - 'azure-sdk-template' - ) - - # The list of services is being constructed from the directory list under the sdk folder - # which, right now, only contains client/data directories. When management is moved to - # the under sdk it'll automatically get picked up. - $ServiceListData = Get-ChildItem "$(Build.SourcesDirectory)/sdk" -Directory - $YmlPath = "$(Build.SourcesDirectory)/docfx_project/api" - New-Item -Path $YmlPath -Name "toc.yml" -Force - foreach ($Dir in $ServiceListData) - { - $mappedDir = "" - if ($serviceMapHash.ContainsKey($Dir.Name)) - { - $mappedDir = $serviceMapHash[$Dir.Name] - } - else - { - $mappedDir = $Dir.Name.ToUpper() - } - - # Store the list of artifacts into the arrays and write them into the .md file - # after processing the list of subdirectories. This will allow the correct - # division of the artifacts under the Client or Management headings - $clientArr = @() - $mgmtArr = @() - - $PkgList = Get-ChildItem $Dir.FullName -Directory -Exclude changelog, faq, .github, build - if (($PkgList | Measure-Object).count -eq 0) - { - continue - } - foreach ($Pkg in $PkgList) - { - # Load the pom file to pull the artifact name and grab the - # parent's relative path to see which parent pom is being - # used to determine whether or not the artifact is client - # or management. - $PomPath = Join-Path -Path $Pkg -ChildPath "pom.xml" - - # no pom file = nothing to process - if (Test-Path -path $PomPath) - { - $xml = New-Object xml - $xml.Load($PomPath) - # Get the artifactId from the POM - $artifactId = $xml.project.artifactId - - $parent = $xml.project.parent.relativePath - - # If this is an artifact that isn't shipping then just - # move on to the next one - if ($ArtifactsToSkip -contains $artifactId) - { - Write-Output "skipping $artifactId" - continue - } - - # If the parent is null or empty then the pom isn't directly including - # one of the pom.[client|data|management].xml and needs to be specially - # handled - if (("" -eq $parent) -or ($null -eq $parent)) - { - # Cosmos has a root pom which includes pom.client.xml that won't - # be detected by this logic. It's easier to deal with specially - # than it is to try and climb the pom chain here. - if ($Dir.BaseName -eq 'cosmos') - { - $clientArr += $artifactId - } - else - { - Write-Host "*snowflake* Pom $PomPath, has a null or empty relative path." - } - } - else - { - if (($parent.IndexOf('pom.client.xml') -ne -1) -or ($parent.IndexOf('pom.data.xml') -ne -1)) - { - $clientArr += $artifactId - } - else - { - $mgmtArr += $artifactId - } - } - } - } - # Only create this if there's something to create - if (($clientArr.Count -gt 0) -or ($mgmtArr.Count -gt 0)) - { - New-Item -Path $YmlPath -Name "$($Dir.Name).md" -Force - Add-Content -Path "$($YmlPath)/toc.yml" -Value "- name: $($mappedDir)`r`n href: $($Dir.Name).md" - # loop through the arrays and add the appropriate artifacts under the appropriate headings - if ($clientArr.Count -gt 0) - { - Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "# Client Libraries" - foreach($lib in $clientArr) - { - Write-Host "Write $($lib) to $($Dir.Name).md" - Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "#### $lib" - } - } - if ($mgmtArr.Count -gt 0) - { - Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "# Management Libraries" - foreach($lib in $mgmtArr) - { - Write-Output "Write $($lib) to $($Dir.Name).md" - Add-Content -Path "$($YmlPath)/$($Dir.Name).md" -Value "#### $lib" - } - } - } - } - - New-Item -Path "$(Build.SourcesDirectory)/docfx_project" -Name "toc.yml" -Force - Add-Content -Path "$(Build.SourcesDirectory)/docfx_project/toc.yml" -Value "- name: Azure SDK for Java APIs`r`n href: api/`r`n homepage: api/index.md" - Copy-Item "$(Build.SourcesDirectory)/README.md" -Destination "$(Build.SourcesDirectory)/docfx_project/api/index.md" -Force - displayName: Create main index and navigation toc.yml, copy over readme. - - pwsh: ls - workingDirectory: $(Build.SourcesDirectory)/docfx_project/api - - task: CmdLine@2 - displayName: Build Doc Content - inputs: - script: $(Build.BinariesDirectory)/docfx/docfx.exe build - workingDirectory: $(Build.SourcesDirectory)/docfx_project/ - failOnStderr: true - pwsh: | - Copy-Item "$(Build.SourcesDirectory)/eng/docgeneration/assets/*" -Destination "$(Build.SourcesDirectory)/docfx_project/_site/" -Force - displayName: Replace site assets + $(Build.SourcesDirectory)/eng/docgeneration/Generate-DocIndex.ps1 -RepoRoot $(Build.SourcesDirectory) -DocGenDir "$(Build.SourcesDirectory)/eng/docgeneration" -verbose + displayName: 'Generate Doc Index' + - task: UsePythonVersion@0 displayName: 'Use Python 3.6' inputs: diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index cbe405cb52d7..595aea3352e9 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -8,26 +8,38 @@ parameters: OSName: 'Linux' OSVmImage: 'ubuntu-16.04' JavaVersion: '1.8' + RunTitle: 'Linux on Java 1.8' macOS - Java 8: OSName: 'macOS' OSVmImage: 'macOS-10.13' JavaVersion: '1.8' + RunTitle: 'macOS on Java 1.8' Windows - Java 8: OSName: 'Windows' OSVmImage: 'windows-2019' JavaVersion: '1.8' + RunTitle: 'Windows on Java 1.8' Linux - Java 11: OSName: 'Linux' OSVmImage: 'ubuntu-16.04' JavaVersion: '1.11' + RunTitle: 'Linux on Java 1.11' macOS - Java 11: OSName: 'macOS' OSVmImage: 'macOS-10.13' JavaVersion: '1.11' + RunTitle: 'macOS on Java 1.11' Windows - Java 11: OSName: 'Windows' OSVmImage: 'windows-2019' JavaVersion: '1.11' + RunTitle: 'Windows on Java 1.11' + Windows From Source - Java 8: + OSName: 'Windows' + OSVmImage: 'windows-2019' + JavaVersion: '1.8' + RunTitle: 'From Source: Windows on Java 1.8' + TestFromSource: true jobs: - job: 'Build' @@ -277,6 +289,35 @@ jobs: - ${{ parameters.PreTestSteps }} + - task: UsePythonVersion@0 + displayName: 'Use Python 3.6' + inputs: + versionSpec: '3.6' + condition: and(ne(variables['SdkType'], 'data'), eq(variables['TestFromSource'],'true')) + + - pwsh: | + python --version + python eng/versioning/set_versions.py --build-type client --pst + if ($LastExitCode -eq 5678) { + echo "##vso[task.setvariable variable=ShouldRunSourceTests]$true" + echo "Changes detected, return code from set_versions.py is $($LastExitCode)" + exit 0 + } elseif ($LastExitCode -eq 0) { + echo "No changes detected, return code from set_versions.py is $($LastExitCode)" + exit 0 + } else { + echo "Invalid return code from set_versions.py, return code is $($LastExitCode)" + exit 1 + } + displayName: 'Set versions for source build' + condition: and(ne(variables['SdkType'], 'data'), eq(variables['TestFromSource'],'true')) + + - script: | + python --version + python eng/versioning/update_versions.py --update-type library --build-type client + condition: eq(variables['ShouldRunSourceTests'],'true') + displayName: 'Update versions for source build' + - task: Maven@3 displayName: 'Run tests' inputs: @@ -288,9 +329,12 @@ jobs: jdkArchitectureOption: 'x64' publishJUnitResults: false goals: ${{ parameters.TestGoals }} + # we want to run this when TestFromSource isn't true (which covers normal running when it isn't set) + # OR when ShouldRunSourceTests is true + condition: and(succeeded(), or(ne(variables['TestFromSource'],'true'), eq(variables['ShouldRunSourceTests'],'true'))) - task: PublishTestResults@2 - condition: always() + condition: and(always(), or(ne(variables['TestFromSource'],'true'), eq(variables['ShouldRunSourceTests'],'true'))) inputs: mergeTestResults: true - testRunTitle: '$(OSName) on Java $(JavaVersion)' + testRunTitle: $(RunTitle) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml index 5e0662e47eba..65f52d697a0c 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml @@ -15,7 +15,7 @@ jobs: displayName: 'Run Live tests' inputs: mavenPomFile: ${{ parameters.PomFilePath }} - options: '--batch-mode -Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3' + options: '--batch-mode -Dmaven.wagon.http.pool=false' mavenOptions: '-Xmx3072m -Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.8' diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index a1b3a1b36560..c4c1552346b7 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -37,7 +37,7 @@ parameters: TestName: LiveTest TimeoutInMinutes: 60 TestStepMavenInputs: - options: '-Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3 $(DefaultOptions)' + options: '-Dmaven.wagon.http.pool=false $(DefaultOptions)' mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '$(JavaVersion)' diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index d9460fc279a0..ba794c7ad91e 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -67,12 +67,15 @@ ..\..\sdk\storage\azure-storage-blob-batch\src\samples\java\com ..\..\sdk\storage\azure-storage-blob-cryptography\src\main\java\com ..\..\sdk\storage\azure-storage-blob-cryptography\src\samples\java\com + ..\..\sdk\storage\azure-storage-blob-nio\src\main\java\com + ..\..\sdk\storage\azure-storage-blob-nio\src\samples\java\com ..\..\sdk\storage\azure-storage-file-share\src\main\java\com ..\..\sdk\storage\azure-storage-file-share\src\samples\java\com ..\..\sdk\storage\azure-storage-file-datalake\src\main\java\com ..\..\sdk\storage\azure-storage-file-datalake\src\samples\java\com ..\..\sdk\storage\azure-storage-queue\src\main\java\com ..\..\sdk\storage\azure-storage-queue\src\samples\java\com + ..\..\sdk\textanalytics\azure-ai-textanalytics\src\main\java\com @@ -144,30 +147,35 @@ true + + com.azure + azure-ai-textanalytics + 1.0.0-beta.1 + com.azure azure-data-appconfiguration - 1.0.0-beta.8 + 1.0.1 com.azure azure-core - 1.2.0-beta.1 + 1.2.0 com.azure azure-core-amqp - 1.0.0-beta.9 + 1.0.1 com.azure azure-core-http-netty - 1.2.0-beta.1 + 1.2.0 com.azure azure-core-http-okhttp - 1.1.0-beta.1 + 1.1.0 + 1.1.0 com.azure @@ -187,12 +195,12 @@ com.azure azure-messaging-eventhubs - 5.0.0-beta.7 + 5.0.1 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.0.0-beta.5 + 1.0.1 com.azure @@ -202,7 +210,7 @@ com.azure azure-security-keyvault-certificates - 4.0.0-beta.7 + 4.0.0-beta.8 com.azure @@ -217,12 +225,12 @@ com.azure azure-storage-common - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure azure-storage-blob - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure @@ -234,20 +242,25 @@ azure-storage-blob-cryptography 12.2.0-beta.1 + + com.azure + azure-storage-blob-nio + 12.0.0-beta.1 + com.azure azure-storage-file-share - 12.1.0-beta.1 + 12.1.0-beta.2 com.azure azure-storage-file-datalake - 12.0.0-beta.8 + 12.0.0-beta.9 com.azure azure-storage-queue - 12.2.0-beta.1 + 12.2.0-beta.2 " + Write-Error-With-Color "Error: project/version update tag should be " } else { @@ -275,7 +293,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($retVal) { $script:FoundError = $true - Write-Output "$($retVal)" + Write-Error-With-Color "$($retVal)" } } } @@ -284,7 +302,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { $script:FoundError = $true # # every project string needs to have an update tag and projects version tags are always 'current' - Write-Output "Error: Missing project/version update tag. The tag should be " + Write-Error-With-Color "Error: Missing project/version update tag. The tag should be " } } @@ -292,11 +310,11 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { { # output an error for missing version element $script:FoundError = $true - Write-Output "Error: Could not find project/version node for $($pomFile)" + Write-Error-With-Color "Error: Could not find project/version node for $($pomFile)" } } - if ($xmlPomFile.parent) { + if ($xmlPomFile.project.parent) { # Verify the parent's version $versionNode = $xmlPomFile.SelectSingleNode("/ns:project/ns:parent/ns:version", $xmlNsManager) if ($xmlPomFile.project.parent.version -and $versionNode) @@ -310,7 +328,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($versionNode.NextSibling.Value.Trim() -ne "{x-version-update;$($groupId):$($artifactId);current}") { $script:FoundError = $true - Write-Output "Error: project/parent/version update tag should be " + Write-Error-With-Color "Error: project/parent/version update tag should be " } else { @@ -319,7 +337,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($retVal) { $script:FoundError = $true - Write-Output "$($retVal)" + Write-Error-With-Color "$($retVal)" } } } @@ -327,14 +345,14 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { { $script:FoundError = $true # every project string needs to have an update tag and projects version tags are always 'current' - Write-Output "Error: Missing project/parent/version update tag. The tag should be " + Write-Error-With-Color "Error: Missing project/parent/version update tag. The tag should be " } } else { # output an error for missing version element $script:FoundError = $true - Write-Output "Error: Could not find project/parent/version node for $($pomFile)" + Write-Error-With-Color "Error: Could not find project/parent/version node for $($pomFile)" } } @@ -348,7 +366,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if (!$versionNode) { $script:FoundError = $true - Write-Output "Error: dependency is missing version element for groupId=$($groupId), artifactId=$($artifactId) should be " + Write-Error-With-Color "Error: dependency is missing version element for groupId=$($groupId), artifactId=$($artifactId) should be " continue } if ($versionNode.NextSibling -and $versionNode.NextSibling.NodeType -eq "Comment") @@ -358,7 +376,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($versionNode.NextSibling.Value.Trim() -notmatch "{x-version-update;(\w+)?$($groupId):$($artifactId);\w+}") { $script:FoundError = $true - Write-Output "Error: dependency version update tag for groupId=$($groupId), artifactId=$($artifactId) should be " + Write-Error-With-Color "Error: dependency version update tag for groupId=$($groupId), artifactId=$($artifactId) should be " } else { @@ -367,14 +385,14 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($retVal) { $script:FoundError = $true - Write-Output "$($retVal)" + Write-Error-With-Color $retVal } } } else { $script:FoundError = $true - Write-Output "Error: Missing dependency version update tag for groupId=$($groupId), artifactId=$($artifactId). The tag should be " + Write-Error-With-Color "Error: Missing dependency version update tag for groupId=$($groupId), artifactId=$($artifactId). The tag should be " } } # Verify every plugin has a group, artifact and version @@ -388,14 +406,14 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if (!$groupId) { $script:FoundError = $true - Write-Output "Error: plugin $($artifactId) is missing its groupId tag" + Write-Error-With-Color "Error: plugin $($artifactId) is missing its groupId tag" continue } $versionNode = $pluginNode.GetElementsByTagName("version")[0] if (!$versionNode) { $script:FoundError = $true - Write-Output "Error: plugin is missing version element for groupId=$($groupId), artifactId=$($artifactId) should be " + Write-Error-With-Color "Error: plugin is missing version element for groupId=$($groupId), artifactId=$($artifactId) should be " continue } if ($versionNode.NextSibling -and $versionNode.NextSibling.NodeType -eq "Comment") @@ -405,7 +423,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($versionNode.NextSibling.Value.Trim() -notmatch "{x-version-update;(\w+)?$($groupId):$($artifactId);\w+}") { $script:FoundError = $true - Write-Output "Error: plugin version update tag for groupId=$($groupId), artifactId=$($artifactId) should be " + Write-Error-With-Color "Error: plugin version update tag for groupId=$($groupId), artifactId=$($artifactId) should be " } else { @@ -414,25 +432,25 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object { if ($retVal) { $script:FoundError = $true - Write-Output "$($retVal)" + Write-Error-With-Color "$($retVal)" } } } else { $script:FoundError = $true - Write-Output "Error: Missing plugin version update tag for groupId=$($groupId), artifactId=$($artifactId). The tag should be " + Write-Error-With-Color "Error: Missing plugin version update tag for groupId=$($groupId), artifactId=$($artifactId). The tag should be " } } } $ElapsedTime = $(get-date) - $StartTime $TotalRunTime = "{0:HH:mm:ss}" -f ([datetime]$ElapsedTime.Ticks) -Write-Output "Total run time=$($TotalRunTime)" +Write-Host "Total run time=$($TotalRunTime)" if ($script:FoundError) { - Write-Output "There were errors encountered during execution. Please fix any errors and run the script again." - Write-Output "This script can be run locally from the root of the repo. .\eng\pom_file_version_scanner.ps1" + Write-Error-With-Color "There were errors encountered during execution. Please fix any errors and run the script again." + Write-Error-With-Color "This script can be run locally from the root of the repo. .\eng\pom_file_version_scanner.ps1" exit(1) } diff --git a/eng/versioning/set_versions.py b/eng/versioning/set_versions.py index 53500cb3017f..37e1abca5fc0 100644 --- a/eng/versioning/set_versions.py +++ b/eng/versioning/set_versions.py @@ -14,7 +14,19 @@ # and the current versions. # # -# python utilities/set_versions.py --ut [library|external_dependency|all] --bt [client|data|management] --bq --ar +# python eng/versioning/set_versions.py --ut [library|external_dependency|all] --bt [client|data|management] --bq --ar +# +# Use case: increment the version of a given artifact in the approprate version_[client|data|management].txt file +# +# python eng/versioning/set_versions.py --bt [client|data|management] --increment-version --artifact-id +# For example: To update increment the version of azure-core +# python eng/versioning/set_versions.py --bt client --iv --ar azure-core +# +# Use case: verify the version of a given artifact in the approprate version_[client|data|management].txt file +# +# python eng/versioning/set_versions.py --bt [client|data|management] --verify-version --artifact-id +# For example: To update increment the version of azure-core +# python eng/versioning/set_versions.py --bt client --vv --ar azure-core # # The script must be run at the root of azure-sdk-for-java. @@ -22,65 +34,238 @@ from datetime import timedelta import os import re +import sys import time from utils import BuildType from utils import CodeModule from utils import UpdateType -from utils import version_regex_str_with_anchor +from utils import version_regex_str_with_names_anchored +from utils import prerelease_version_regex_with_name + +# some things that should not be updated for devops builds, in the case where everything is being updated in one call +items_we_should_not_update = ['com.azure:azure-sdk-all', 'com.azure:azure-sdk-parent', 'com.azure:azure-client-sdk-parent', 'azure-data-sdk-parent'] # The regex string we want should be the anchored one since the entire string is what's being matched -version_regex = re.compile(version_regex_str_with_anchor) +version_regex_named = re.compile(version_regex_str_with_names_anchored) +prerelease_regex_named = re.compile(prerelease_version_regex_with_name) -def update_versions_file(update_type, build_type, build_qualifier, artifact_id): +def update_versions_file_for_nightly_devops(update_type, build_type, build_qualifier, artifact_id): version_file = os.path.normpath('eng/versioning/version_' + build_type.name + '.txt') print('version_file=' + version_file) - + version_map = {} newlines = [] - with open(version_file) as f: + with open(version_file, encoding='utf-8') as f: for raw_line in f: stripped_line = raw_line.strip() if not stripped_line or stripped_line.startswith('#'): newlines.append(raw_line) else: module = CodeModule(stripped_line) + # basically we don't want to change any of the parent versions here, only + # library versions + if not artifact_id and module.name in items_we_should_not_update: + newlines.append(module.string_for_version_file()) + continue if not artifact_id or module.artifact_id == artifact_id: - if update_type == UpdateType.library or update_type == UpdateType.all: - if '-' in module.current: - module.current += "." + build_qualifier + if (update_type == UpdateType.library or update_type == UpdateType.all): + if hasattr(module, 'current'): + set_both = False + # In the case where the current and dependency are both equal then both + # need to be updated. In theory, this should only really happen when a + # new library has been added and has not yet been released but can also + # happen if a library has just been released and the devops build kicks + # of before the human submits the PR to increase the current version. Being + # that it's a devops build and both versions are being updated this should + # be OK. + if module.current == module.dependency: + set_both = True + if '-' in module.current: + module.current += "." + build_qualifier + else: + module.current += '-' + build_qualifier + match = version_regex_named.match(module.current) + if not match: + raise ValueError('{}\'s current version + build qualifier {} is not a valid semver version'.format(module.name, module.current + build_qualifier)) + if set_both: + module.dependency = module.current + # we need to handle the unreleased dependency which should have the same version as the "current" dependency + # of the non-unreleased artifact else: - module.current += '-' + build_qualifier - match = version_regex.match(module.current) - if not match: - raise ValueError('{}\'s current version + build qualifier {} is not a valid semver version'.format(module.name, module.current + build_qualifier)) - if update_type == UpdateType.external_dependency or update_type == UpdateType.all: - if '-' in module.dependency: - module.dependency += "." + build_qualifier - else: - module.dependency += '-' + build_qualifier - match = version_regex.match(module.dependency) - if not match: - raise ValueError('{}\'s dependency version + build qualifier {} is not a valid semver version'.format(module.name, module.dependency + build_qualifier)) + if (module.name.startswith('unreleased_')): + # strip off the 'unreleased_' prepend to get the regular module entry + real_name = module.name.replace('unreleased_', '') + real_module = version_map[real_name] + module.dependency = real_module.current + else: + raise ValueError('{}\' does not have a current dependency and its groupId does not the required unreleased_ prepend'.format(module.name)) + version_map[module.name] = module + newlines.append(module.string_for_version_file()) + + with open(version_file, 'w', encoding='utf-8') as f: + for line in newlines: + f.write(line) + +# Prep the appropriate version file for source +def prep_version_file_for_source_testing(build_type): + + version_file = os.path.normpath('eng/versioning/version_' + build_type.name + '.txt') + print('version_file=' + version_file) + file_changed = False + + newlines = [] + with open(version_file, encoding='utf-8') as f: + for raw_line in f: + stripped_line = raw_line.strip() + if not stripped_line or stripped_line.startswith('#'): + newlines.append(raw_line) + else: + module = CodeModule(stripped_line) + if hasattr(module, 'current') and not module.current == module.dependency: + module.dependency = module.current + file_changed = True newlines.append(module.string_for_version_file()) - with open(version_file, 'w') as f: + with open(version_file, 'w', encoding='utf-8') as f: for line in newlines: f.write(line) + return file_changed + +# given a build type and artifact id +def increment_version_for_artifact(build_type, artifact_id): + + if not build_type: + raise ValueError('build_type cannot be empty.') + + if not artifact_id: + raise ValueError('artifact_id cannot be empty.') + + version_file = os.path.normpath('eng/versioning/version_' + build_type.name + '.txt') + print('version_file=' + version_file) + + artifact_found = False + newlines = [] + with open(version_file, encoding='utf-8') as f: + for raw_line in f: + stripped_line = raw_line.strip() + if not stripped_line or stripped_line.startswith('#'): + newlines.append(raw_line) + else: + module = CodeModule(stripped_line) + # Tick up the version here. If the version is already a pre-release + # version then just increment the revision. Otherwise increment the + # minor version, zero the patch and add "-beta.1" to the end + # https://github.com/Azure/azure-sdk/blob/master/docs/policies/releases.md#java + if module.artifact_id == artifact_id and hasattr(module, 'current'): + artifact_found = True + vmatch = version_regex_named.match(module.current) + if (vmatch.group('prerelease') is not None): + prever = prerelease_regex_named.match(vmatch.group('prerelease')) + rev = int(prever.group('revision')) + rev += 1 + new_version = '{}.{}.{}-beta.{}'.format(vmatch.group('major'), vmatch.group('minor'), vmatch.group('patch'), str(rev)) + else: + minor = int(vmatch.group('minor')) + minor += 1 + new_version = '{}.{}.{}-beta.1'.format(vmatch.group('major'), minor, 0) + print('artifact_id {}, previous version={}, new current version={}'.format(artifact_id, module.current, new_version)) + module.current = new_version + newlines.append(module.string_for_version_file()) + + if not artifact_found: + raise ValueError('artifact_id ({}) was not found in version file {}'.format(artifact_id, version_file)) + + with open(version_file, 'w', encoding='utf-8') as f: + for line in newlines: + f.write(line) + +# Verify that the current version of an artifact matches our versioning scheme. This is meant to be called +# as part of the release pipeline for a given artifact to verify that we don't accidentally release a version +# that doesn't match our versioning scheme +def verify_current_version_of_artifact(build_type, artifact_id): + if not build_type: + raise ValueError('build_type cannot be empty.') + + if not artifact_id: + raise ValueError('artifact_id cannot be empty.') + + version_file = os.path.normpath('eng/versioning/version_' + build_type.name + '.txt') + print('version_file=' + version_file) + + artifact_found = False + with open(version_file, encoding='utf-8') as f: + for raw_line in f: + stripped_line = raw_line.strip() + if not stripped_line or stripped_line.startswith('#'): + continue + else: + module = CodeModule(stripped_line) + # verify the current version of the artifact matches our version schema which is one + # of the following: + # .. + # ..-beta. + if module.artifact_id == artifact_id and hasattr(module, 'current'): + artifact_found = True + vmatch = version_regex_named.match(module.current) + temp_ver = '{}.{}.{}'.format(vmatch.group('major'), vmatch.group('minor'), vmatch.group('patch')) + # we should never have buildmetadata in our versioning scheme + if vmatch.group('buildmetadata') is not None: + raise ValueError('artifact ({}) version ({}) in version file ({}) is not a correct version to release. buildmetadata is set and should never be {}'.format(artifact_id, module.current, version_file, vmatch.group('buildmetadata'))) + + # reconstruct the version from the semver pieces and it should match exactly the current + # version in the module + # If there's a pre-release version it should be beta.X + if vmatch.group('prerelease') is not None: + prerel = vmatch.group('prerelease') + + if prerelease_regex_named.match(prerel) is None: + raise ValueError('artifact ({}) version ({}) in version file ({}) is not a correct version to release. The accepted prerelease tag is (beta.X) and the current prerelease tag is ({})'.format(artifact_id, module.current, version_file, prerel)) + + prever = prerelease_regex_named.match(prerel) + rev = int(prever.group('revision')) + temp_ver = '{}-beta.{}'.format(temp_ver, str(rev)) + + # last but not least, for sanity verify that the version constructed from the + # semver pieces matches module's current version + if module.current != temp_ver: + raise ValueError('artifact ({}) version ({}) in version file ({}) does not match the version constructed from the semver pieces ({})'.format(artifact_id, module.current, version_file, temp_ver)) + + print('The version {} for {} looks good!'.format(module.current, module.name)) + + + if not artifact_found: + raise ValueError('artifact_id ({}) was not found in version file {}'.format(artifact_id, version_file)) + def main(): parser = argparse.ArgumentParser(description='set version numbers in the appropriate version text file') parser.add_argument('--update-type', '--ut', type=UpdateType, choices=list(UpdateType)) parser.add_argument('--build-type', '--bt', type=BuildType, choices=list(BuildType)) parser.add_argument('--build-qualifier', '--bq', help='build qualifier to append onto the version string.') parser.add_argument('--artifact-id', '--ar', help='artifactId to target.') + parser.add_argument('--prep-source-testing', '--pst', action='store_true', help='prep the version file for source testing') + parser.add_argument('--increment-version', '--iv', action='store_true', help='increment the version for a given artifact') + parser.add_argument('--verify-version', '--vv', action='store_true', help='verify the version for a given artifact') args = parser.parse_args() if (args.build_type == BuildType.management): raise ValueError('{} is not currently supported.'.format(BuildType.management.name)) start_time = time.time() - update_versions_file(args.update_type, args.build_type, args.build_qualifier, args.artifact_id) + file_changed = False + if (args.prep_source_testing): + file_changed = prep_version_file_for_source_testing(args.build_type) + elif (args.increment_version): + increment_version_for_artifact(args.build_type, args.artifact_id) + elif (args.verify_version): + verify_current_version_of_artifact(args.build_type, args.artifact_id) + else: + update_versions_file_for_nightly_devops(args.update_type, args.build_type, args.build_qualifier, args.artifact_id) elapsed_time = time.time() - start_time print('elapsed_time={}'.format(elapsed_time)) print('Total time for replacement: {}'.format(str(timedelta(seconds=elapsed_time)))) + # if the file changed flag is set, which only happens through a call to prep_version_file_for_source_testing, + # then exit with a unique code that allows us to know that something changed. + if (file_changed): + sys.exit(5678) if __name__ == '__main__': main() \ No newline at end of file diff --git a/eng/versioning/update_versions.py b/eng/versioning/update_versions.py index 15a6669b91e4..68f5b389a05a 100644 --- a/eng/versioning/update_versions.py +++ b/eng/versioning/update_versions.py @@ -150,22 +150,26 @@ def update_versions_all(update_type, build_type, target_file, skip_readme): # This is a temporary stop gap to deal with versions hard coded in java files. # Everything within the begin/end tags below can be deleted once - # https://github.com/Azure/azure-sdk-for-java/issues/3141 has been fixed. + # https://github.com/Azure/azure-sdk-for-java/issues/7106 has been fixed. # version_*_java_files.txt # BEGIN:Versions_in_java_files if not target_file and BuildType.none != build_type: # the good thing here is that the java files only contain library versions, not # external versions version_java_file = os.path.normpath('eng/versioning/version_' + build_type.name + '_java_files.txt') - with open(version_java_file) as f: - for raw_line in f: - java_file_to_update = raw_line.strip() - if not java_file_to_update or java_file_to_update.startswith('#'): - continue - if os.path.isfile(java_file_to_update): - update_versions(version_map, java_file_to_update) - else: - raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), java_file_to_update) + + if os.path.exists(version_java_file): + with open(version_java_file) as f: + for raw_line in f: + java_file_to_update = raw_line.strip() + if not java_file_to_update or java_file_to_update.startswith('#'): + continue + if os.path.isfile(java_file_to_update): + update_versions(version_map, java_file_to_update) + else: + raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), java_file_to_update) + else: + print(version_java_file + ' does not exist. Skipping.') # END:Versions_in_java_files def main(): diff --git a/eng/versioning/utils.py b/eng/versioning/utils.py index a1a4c8e486d4..8928047f8055 100644 --- a/eng/versioning/utils.py +++ b/eng/versioning/utils.py @@ -27,7 +27,10 @@ # This is the regex that would be used to ensure the entire string matches # semver format # https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string -version_regex_str_with_anchor = r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' +version_regex_str_with_names_anchored = r'^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + +# This is specific to our revision which, if there is one, needs to have the format of beta.X +prerelease_version_regex_with_name = r'^beta\.(?P0|[1-9]\d*)$' class UpdateType(Enum): external_dependency = 'external_dependency' @@ -62,10 +65,16 @@ def __init__(self, module_str): self.group_id = items[0].split(':')[0] self.artifact_id = items[0].split(':')[1] - if len(items) == 2: - self.external_dependency = items[1].strip() - self.update_type = UpdateType.external_dependency + if len(items) == 2: + if self.group_id.startswith('unreleased_'): + self.dependency = items[1].strip() + self.update_type = UpdateType.library + else: + self.external_dependency = items[1].strip() + self.update_type = UpdateType.external_dependency elif len(items) == 3: + if self.group_id.startswith('unreleased_'): + raise ValueError('Unreleased dependency entries should not have a current version, they should only a dependency version') self.dependency = items[1] self.current = items[2].strip() self.update_type = UpdateType.library @@ -75,11 +84,16 @@ def __init__(self, module_str): # overridden string primarily used for error reporting def __str__(self): # current may or may not exist + if hasattr(self, 'external_dependency'): + return self.name + ': External Dependency version=' + self.external_dependency try: return self.name + ': Dependency version=' + self.dependency + ': Current version=' + self.current except AttributeError: - return self.name + ': External Dependency version=' + self.external_dependency + return self.name + ': Dependency version=' + self.dependency # return the CodeModule string formatted for a version file def string_for_version_file(self): - return self.name + ';' + self.dependency + ';' + self.current + '\n' + try: + return self.name + ';' + self.dependency + ';' + self.current + '\n' + except AttributeError: + return self.name + ';' + self.dependency + '\n' diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2287e6a94a2e..8a1db4f0df4b 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -1,30 +1,40 @@ # Format; -# groupId:artifactId;dependency-version;current-version +# :;dependency-version;current-version com.azure:azure-sdk-all;1.0.0;1.0.0 com.azure:azure-sdk-parent;1.6.0;1.6.0 com.azure:azure-client-sdk-parent;1.7.0;1.7.0 -com.azure:azure-core;1.2.0-beta.1;1.2.0-beta.1 -com.azure:azure-core-amqp;1.0.0-beta.9;1.0.0-beta.9 -com.azure:azure-core-http-netty;1.1.0;1.2.0-beta.1 -com.azure:azure-core-http-okhttp;1.1.0-beta.1;1.1.0-beta.1 +com.azure:azure-ai-textanalytics;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-core;1.1.0;1.2.0 +com.azure:azure-core-amqp;1.0.0-beta.8;1.0.1 +com.azure:azure-core-http-netty;1.1.0;1.2.0 +com.azure:azure-core-http-okhttp;1.0.0;1.1.0 com.azure:azure-core-management;1.0.0-beta.8;1.0.0-beta.8 -com.azure:azure-core-test;1.1.0-beta.1;1.1.0-beta.1 +com.azure:azure-core-test;1.1.0-beta.2;1.1.0 com.azure:azure-core-tracing-opencensus;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-data-appconfiguration;1.0.0-beta.7;1.0.0-beta.8 +com.azure:azure-data-appconfiguration;1.0.0-beta.7;1.0.1 +com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-identity;1.0.1;1.1.0-beta.1 -com.azure:azure-security-keyvault-certificates;4.0.0-beta.6;4.0.0-beta.7 +com.azure:azure-messaging-eventhubs;5.0.0-beta.6;5.0.1 +com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.0.0-beta.4;1.0.1 +com.azure:azure-security-keyvault-certificates;4.0.0-beta.7;4.0.0-beta.8 com.azure:azure-security-keyvault-keys;4.0.1;4.1.0-beta.1 com.azure:azure-security-keyvault-secrets;4.0.1;4.1.0-beta.1 -com.azure:azure-messaging-eventhubs;5.0.0-beta.6;5.0.0-beta.7 -com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-sdk-template;1.0.4-beta.2;1.0.4-beta.2 -com.azure:azure-storage-blob;12.1.0;12.2.0-beta.1 +com.azure:azure-storage-blob;12.2.0-beta.1;12.2.0-beta.2 com.azure:azure-storage-blob-batch;12.1.0;12.2.0-beta.1 com.azure:azure-storage-blob-cryptography;12.1.0;12.2.0-beta.1 -com.azure:azure-storage-common;12.1.0;12.2.0-beta.1 -com.azure:azure-storage-file-share;12.0.0;12.1.0-beta.1 -com.azure:azure-storage-file-datalake;12.0.0-beta.7;12.0.0-beta.8 -com.azure:azure-storage-queue;12.1.0;12.2.0-beta.1 -com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 \ No newline at end of file +com.azure:azure-storage-blob-nio;12.0.0-beta.1;12.0.0-beta.1 +com.azure:azure-storage-common;12.2.0-beta.1;12.2.0-beta.2 +com.azure:azure-storage-file-share;12.1.0-beta.1;12.1.0-beta.2 +com.azure:azure-storage-file-datalake;12.0.0-beta.8;12.0.0-beta.9 +com.azure:azure-storage-queue;12.2.0-beta.1;12.2.0-beta.2 + +# Unreleased dependencies: Copy the entry from above, prepent "unreleased_" and remove the current +# version. Unreleased dependencies are only valid for dependency versions +# Format; +# unreleased_:;dependency-version +unreleased_com.azure:azure-core;1.2.0 +unreleased_com.azure:azure-core-amqp;1.0.1 +unreleased_com.azure:azure-core-test;1.1.0-beta.2 diff --git a/eng/versioning/version_client_java_files.txt b/eng/versioning/version_client_java_files.txt deleted file mode 100644 index 9f2721aa11ba..000000000000 --- a/eng/versioning/version_client_java_files.txt +++ /dev/null @@ -1,6 +0,0 @@ -# This is necessary because there are java files with a hard coded version in them that need to -# get updated when versions get updated. Once https://github.com/Azure/azure-sdk-for-java/issues/3141 -# has been fixed this file and the update logic in update_versions.py should no longer be necessary. - -# The file format here should be the relative path from the root of the azure-sdk-for-java -sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClientConstants.java diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 3d43d7e843fc..34e4db077779 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -23,10 +23,12 @@ com.microsoft.azure.cognitiveservices:azure-cognitiveservices-contentmoderator;1 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-customvision-prediction;1.1.0-beta.3;1.1.0-beta.3 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-customvision-training;1.1.0-beta.3;1.1.0-beta.3 com.microsoft.azure.cognitiveservices:azure-cognitiveservices-faceapi;1.1.0-beta.1;1.1.0-beta.1 -com.microsoft.azure:azure-cosmos-parent;3.4.0;3.5.0 -com.microsoft.azure:azure-cosmos;3.4.0;3.5.0 -com.microsoft.azure:azure-cosmos-benchmark;3.5.0;3.5.0 -com.microsoft.azure:azure-cosmos-examples;3.5.0;3.5.0 +# azure-cosmos-parent doesn't have a dependency management section anymore, it doesn't need to change unless parent pom changes +com.microsoft.azure:azure-cosmos-parent;3.5.0;3.5.0 +com.microsoft.azure:azure-cosmos;3.6.0-beta.1;3.6.0-beta.2 +# benchmark and examples aren't released but we're keeping the version in sync with the current cosmos version +com.microsoft.azure:azure-cosmos-benchmark;3.6.0-beta.2;3.6.0-beta.2 +com.microsoft.azure:azure-cosmos-examples;3.6.0-beta.2;3.6.0-beta.2 com.microsoft.azure:azure-eventhubs;3.1.0;3.1.0 com.microsoft.azure:azure-eventhubs-eph;3.1.0;3.1.0 com.microsoft.azure:azure-eventhubs-extensions;3.1.0;3.1.0 diff --git a/packages.md b/packages.md new file mode 100644 index 000000000000..387cb277fac7 --- /dev/null +++ b/packages.md @@ -0,0 +1,222 @@ + +# Package Index - azure-sdk-for-java + +| Artifact Id | Group Id | Readme | Published Url | +|----------------|-----------|-----------|---------------------| +| [`azure`]( profiles/2019-03-01-hybrid/azure/pom.xml )| `com.microsoft.azure.profile_2019_03_01_hybrid` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.profile_2019_03_01_hybrid/azure ) | +| [`azure`]( profiles/2018-03-01-hybrid/azure/pom.xml )| `com.microsoft.azure.profile_2018_03_01_hybrid` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.profile_2018_03_01_hybrid/azure ) | +| [`azure-applicationinsights-query`]( sdk/applicationinsights/microsoft-azure-applicationinsights-query/pom.xml )| `com.microsoft.azure` | [Readme](sdk/applicationinsights/microsoft-azure-applicationinsights-query/README.md) | N/A | +| [`azure-authentication-msi-token-provider`]( sdk/authorization/microsoft-azure-authentication-msi-token-provider/pom.xml )| `com.microsoft.azure.msi_auth_token_provider` | [Readme](sdk/authorization/microsoft-azure-authentication-msi-token-provider/readme.md) | N/A | +| [`azure-batch`]( sdk/batch/microsoft-azure-batch/pom.xml )| `com.microsoft.azure` | [Readme](sdk/batch/microsoft-azure-batch/README.md) | N/A | +| [`azure-cognitiveservices-autosuggest`]( sdk/cognitiveservices/ms-azure-cs-autosuggest/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-computervision`]( sdk/cognitiveservices/ms-azure-cs-computervision/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-contentmoderator`]( sdk/cognitiveservices/ms-azure-cs-contentmoderator/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-customimagesearch`]( sdk/cognitiveservices/ms-azure-cs-customimagesearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-customsearch`]( sdk/cognitiveservices/ms-azure-cs-customsearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-customvision-prediction`]( sdk/cognitiveservices/ms-azure-cs-customvision-prediction/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-customvision-training`]( sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-entitysearch`]( sdk/cognitiveservices/ms-azure-cs-entitysearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-faceapi`]( sdk/cognitiveservices/ms-azure-cs-faceapi/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-imagesearch`]( sdk/cognitiveservices/ms-azure-cs-imagesearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-luis-authoring`]( sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-luis-runtime`]( sdk/cognitiveservices/ms-azure-cs-luis-runtime/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-newssearch`]( sdk/cognitiveservices/ms-azure-cs-newssearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-spellcheck`]( sdk/cognitiveservices/ms-azure-cs-spellcheck/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-textanalytics`]( sdk/cognitiveservices/ms-azure-cs-textanalytics/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-videosearch`]( sdk/cognitiveservices/ms-azure-cs-videosearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-visualsearch`]( sdk/cognitiveservices/ms-azure-cs-visualsearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-cognitiveservices-websearch`]( sdk/cognitiveservices/ms-azure-cs-websearch/pom.xml )| `com.microsoft.azure.cognitiveservices` | N/A | N/A | +| [`azure-core`]( sdk/core/azure-core/pom.xml )| `com.azure` | [Readme](sdk/core/azure-core/README.md) | [Maven]( https://search.maven.org/artifact/com.azure/azure-core ) | +| [`azure-core-amqp`]( sdk/core/azure-core-amqp/pom.xml )| `com.azure` | [Readme](sdk/core/azure-core-amqp/README.md) | [Maven]( https://search.maven.org/artifact/com.azure/azure-core-amqp ) | +| [`azure-core-http-netty`]( sdk/core/azure-core-http-netty/pom.xml )| `com.azure` | [Readme](sdk/core/azure-core-http-netty/README.md) | [Maven]( https://search.maven.org/artifact/com.azure/azure-core-http-netty ) | +| [`azure-core-http-okhttp`]( sdk/core/azure-core-http-okhttp/pom.xml )| `com.azure` | [Readme](sdk/core/azure-core-http-okhttp/README.md) | [Maven]( https://search.maven.org/artifact/com.azure/azure-core-http-okhttp ) | +| [`azure-core-management`]( sdk/core/azure-core-management/pom.xml )| `com.azure` | N/A | N/A | +| [`azure-core-test`]( sdk/core/azure-core-test/pom.xml )| `com.azure` | [Readme](sdk/core/azure-core-test/README.md) | [Maven]( https://search.maven.org/artifact/com.azure/azure-core-test ) | +| [`azure-cosmos`]( sdk/cosmos/microsoft-azure-cosmos/pom.xml )| `com.microsoft.azure` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure/azure-cosmos ) | +| [`azure-eventgrid`]( sdk/eventgrid/microsoft-azure-eventgrid/pom.xml )| `com.microsoft.azure` | [Readme](sdk/eventgrid/microsoft-azure-eventgrid/README.md) | N/A | +| [`azure-keyvault`]( sdk/keyvault/microsoft-azure-keyvault/pom.xml )| `com.microsoft.azure` | N/A | N/A | +| [`azure-keyvault-core`]( sdk/keyvault/microsoft-azure-keyvault-core/pom.xml )| `com.microsoft.azure` | N/A | N/A | +| [`azure-keyvault-cryptography`]( sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml )| `com.microsoft.azure` | N/A | N/A | +| [`azure-keyvault-extensions`]( sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml )| `com.microsoft.azure` | N/A | N/A | +| [`azure-keyvault-webkey`]( sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml )| `com.microsoft.azure` | N/A | N/A | +| [`azure-loganalytics`]( sdk/loganalytics/microsoft-azure-loganalytics/pom.xml )| `com.microsoft.azure` | [Readme](sdk/loganalytics/microsoft-azure-loganalytics/README.md) | N/A | +| [`azure-media`]( sdk/mediaservices/microsoft-azure-media/pom.xml )| `com.microsoft.azure` | N/A | N/A | +| [`azure-mgmt-advisor`]( advisor/resource-manager/v2017_04_19/pom.xml )| `com.microsoft.azure.advisor.v2017_04_19` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.advisor.v2017_04_19/azure-mgmt-advisor ) | +| [`azure-mgmt-apimanagement`]( apimanagement/resource-manager/v2018_06_01_preview/pom.xml )| `com.microsoft.azure.apimanagement.v2018_06_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.apimanagement.v2018_06_01_preview/azure-mgmt-apimanagement ) | +| [`azure-mgmt-apimanagement`]( apimanagement/resource-manager/v2019_01_01/pom.xml )| `com.microsoft.azure.apimanagement.v2019_01_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.apimanagement.v2019_01_01/azure-mgmt-apimanagement ) | +| [`azure-mgmt-appconfiguration`]( appconfiguration/resource-manager/v2019_02_01_preview/pom.xml )| `com.microsoft.azure.appconfiguration.v2019_02_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.appconfiguration.v2019_02_01_preview/azure-mgmt-appconfiguration ) | +| [`azure-mgmt-appservice`]( appservice/resource-manager/v2016_08_01/pom.xml )| `com.microsoft.azure.appservice.v2016_08_01` | N/A | N/A | +| [`azure-mgmt-appservice`]( appservice/resource-manager/v2016_03_01/pom.xml )| `com.microsoft.azure.appservice.v2016_03_01` | N/A | N/A | +| [`azure-mgmt-appservice`]( appservice/resource-manager/v2018_02_01/pom.xml )| `com.microsoft.azure.appservice.v2018_02_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.appservice.v2018_02_01/azure-mgmt-appservice ) | +| [`azure-mgmt-appservice`]( appservice/resource-manager/v2016_09_01/pom.xml )| `com.microsoft.azure.appservice.v2016_09_01` | N/A | N/A | +| [`azure-mgmt-authorization`]( authorization/resource-manager/v2018_07_01_preview/pom.xml )| `com.microsoft.azure.authorization.v2018_07_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.authorization.v2018_07_01_preview/azure-mgmt-authorization ) | +| [`azure-mgmt-authorization`]( authorization/resource-manager/v2015_07_01/pom.xml )| `com.microsoft.azure.authorization.v2015_07_01` | N/A | N/A | +| [`azure-mgmt-authorization`]( authorization/resource-manager/v2018_09_01_preview/pom.xml )| `com.microsoft.azure.authorization.v2018_09_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.authorization.v2018_09_01_preview/azure-mgmt-authorization ) | +| [`azure-mgmt-authorization`]( authorization/resource-manager/v2015_06_01/pom.xml )| `com.microsoft.azure.authorization.v2015_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.authorization.v2015_06_01/azure-mgmt-authorization ) | +| [`azure-mgmt-automation`]( automation/resource-manager/v2018_06_30/pom.xml )| `com.microsoft.azure.automation.v2018_06_30` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.automation.v2018_06_30/azure-mgmt-automation ) | +| [`azure-mgmt-automation`]( automation/resource-manager/v2015_10_31/pom.xml )| `com.microsoft.azure.automation.v2015_10_31` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.automation.v2015_10_31/azure-mgmt-automation ) | +| [`azure-mgmt-azurestack`]( azurestack/resource-manager/v2017_06_01/pom.xml )| `com.microsoft.azure.azurestack.v2017_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.azurestack.v2017_06_01/azure-mgmt-azurestack ) | +| [`azure-mgmt-batchai`]( batchai/resource-manager/v2017_09_01_preview/pom.xml )| `com.microsoft.azure.batchai.v2017_09_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.batchai.v2017_09_01_preview/azure-mgmt-batchai ) | +| [`azure-mgmt-batchai`]( batchai/resource-manager/v2018_05_01/pom.xml )| `com.microsoft.azure.batchai.v2018_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.batchai.v2018_05_01/azure-mgmt-batchai ) | +| [`azure-mgmt-batchai`]( batchai/resource-manager/v2018_03_01/pom.xml )| `com.microsoft.azure.batchai.v2018_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.batchai.v2018_03_01/azure-mgmt-batchai ) | +| [`azure-mgmt-cognitiveservices`]( cognitiveservices/resource-manager/v2016_02_01_preview/pom.xml )| `com.microsoft.azure.azure-mgmt-cognitiveservices-2016-02-01-preview` | N/A | N/A | +| [`azure-mgmt-cognitiveservices`]( cognitiveservices/resource-manager/v2017_04_18/pom.xml )| `com.microsoft.azure.azure-mgmt-cognitiveservices-2017-04-18` | N/A | N/A | +| [`azure-mgmt-compute`]( compute/resource-manager/v2017_12_01/pom.xml )| `com.microsoft.azure.compute.v2017_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.compute.v2017_12_01/azure-mgmt-compute ) | +| [`azure-mgmt-compute`]( compute/resource-manager/v2018_09_30/pom.xml )| `com.microsoft.azure.compute.v2018_09_30` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.compute.v2018_09_30/azure-mgmt-compute ) | +| [`azure-mgmt-compute`]( compute/resource-manager/v2017_09_01/pom.xml )| `com.microsoft.azure.compute.v2017_09_01` | N/A | N/A | +| [`azure-mgmt-compute`]( compute/resource-manager/v2018_04_01/pom.xml )| `com.microsoft.azure.compute.v2018_04_01` | N/A | N/A | +| [`azure-mgmt-compute`]( compute/resource-manager/v2017_03_30/pom.xml )| `com.microsoft.azure.compute.v2017_03_30` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute ) | +| [`azure-mgmt-containerinstance`]( containerinstance/resource-manager/v2018_02_01_preview/pom.xml )| `com.microsoft.azure.containerinstance.v2018_02_01_preview` | N/A | N/A | +| [`azure-mgmt-containerinstance`]( containerinstance/resource-manager/v2018_04_01/pom.xml )| `com.microsoft.azure.containerinstance.v2018_04_01` | N/A | N/A | +| [`azure-mgmt-containerinstance`]( containerinstance/resource-manager/v2017_10_01_preview/pom.xml )| `com.microsoft.azure.containerinstance.v2017_10_01_preview` | N/A | N/A | +| [`azure-mgmt-containerinstance`]( containerinstance/resource-manager/v2017_08_01_preview/pom.xml )| `com.microsoft.azure.containerinstance.v2017_08_01_preview` | N/A | N/A | +| [`azure-mgmt-containerinstance`]( containerinstance/resource-manager/v2018_10_01/pom.xml )| `com.microsoft.azure.containerinstance.v2018_10_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerinstance.v2018_10_01/azure-mgmt-containerinstance ) | +| [`azure-mgmt-containerinstance`]( containerinstance/resource-manager/v2017_12_01_preview/pom.xml )| `com.microsoft.azure.containerinstance.v2017_12_01_preview` | N/A | N/A | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2017_10_01/pom.xml )| `com.microsoft.azure.containerregistry.v2017_10_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2017_10_01/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2017_06_01_preview/pom.xml )| `com.microsoft.azure.containerregistry.v2017_06_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2017_06_01_preview/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2018_09_01/pom.xml )| `com.microsoft.azure.containerregistry.v2018_09_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2018_09_01/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2019_04_01/pom.xml )| `com.microsoft.azure.containerregistry.v2019_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2019_04_01/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2018_02_01_preview/pom.xml )| `com.microsoft.azure.containerregistry.v2018_02_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2018_02_01_preview/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2017_03_01/pom.xml )| `com.microsoft.azure.containerregistry.v2017_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2017_03_01/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2016_06_27_preview/pom.xml )| `com.microsoft.azure.containerregistry.v2016_06_27_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2016_06_27_preview/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerregistry`]( containerregistry/resource-manager/v2019_06_01_preview/pom.xml )| `com.microsoft.azure.containerregistry.v2019_06_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerregistry.v2019_06_01_preview/azure-mgmt-containerregistry ) | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2017_08_31/pom.xml )| `com.microsoft.azure.azure-mgmt-containerservice-2017-08-31` | N/A | N/A | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2019_06_01/pom.xml )| `com.microsoft.azure.containerservice.v2019_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerservice.v2019_06_01/azure-mgmt-containerservice ) | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2018_09_30_preview/pom.xml )| `com.microsoft.azure.containerservice.v2018_09_30_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerservice.v2018_09_30_preview/azure-mgmt-containerservice ) | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2017_07_01/pom.xml )| `com.microsoft.azure.azure-mgmt-containerservice-2017-07-01` | N/A | N/A | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2019_02_01/pom.xml )| `com.microsoft.azure.containerservice.v2019_02_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerservice.v2019_02_01/azure-mgmt-containerservice ) | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/package_2017_09/pom.xml )| `com.microsoft.azure.containerservice-package-2017-09` | N/A | N/A | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2017_09_30/pom.xml )| `com.microsoft.azure.azure-mgmt-containerservice-2017-09-30` | N/A | N/A | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2019_08_01/pom.xml )| `com.microsoft.azure.containerservice.v2019_08_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerservice.v2019_08_01/azure-mgmt-containerservice ) | +| [`azure-mgmt-containerservice`]( containerservice/resource-manager/v2019_04_01/pom.xml )| `com.microsoft.azure.containerservice.v2019_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.containerservice.v2019_04_01/azure-mgmt-containerservice ) | +| [`azure-mgmt-cosmosdb`]( cosmosdb/resource-manager/v2015_04_08/pom.xml )| `com.microsoft.azure.cosmosdb.v2015_04_08` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.cosmosdb.v2015_04_08/azure-mgmt-cosmosdb ) | +| [`azure-mgmt-costmanagement`]( costmanagement/resource-manager/v2018_05_31/pom.xml )| `com.microsoft.azure.costmanagement.v2018_05_31` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.costmanagement.v2018_05_31/azure-mgmt-costmanagement ) | +| [`azure-mgmt-databoxedge`]( edgegateway/resource-manager/v2019_03_01/pom.xml )| `com.microsoft.azure.edgegateway.v2019_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.edgegateway.v2019_03_01/azure-mgmt-databoxedge ) | +| [`azure-mgmt-datalakeanalytics`]( datalakeanalytics/resource-manager/v2016_11_01/pom.xml )| `com.microsoft.azure.datalakeanalytics.v2016_11_01` | N/A | N/A | +| [`azure-mgmt-datalakeanalytics`]( datalakeanalytics/resource-manager/v2015_10_01_preview/pom.xml )| `com.microsoft.azure.datalakeanalytics.v2015_10_01_preview` | N/A | N/A | +| [`azure-mgmt-datalakestore`]( datalakestore/resource-manager/v2016_11_01/pom.xml )| `com.microsoft.azure.datalakestore.v2016_11_01` | N/A | N/A | +| [`azure-mgmt-datalakestore`]( datalakestore/resource-manager/v2015_10_01_preview/pom.xml )| `com.microsoft.azure.datalakestore.v2015_10_01_preview` | N/A | N/A | +| [`azure-mgmt-datamigration`]( datamigration/resource-manager/v2017_11_15_preview/pom.xml )| `com.microsoft.azure.datamigration.v2017_11_15_preview` | N/A | N/A | +| [`azure-mgmt-datamigration`]( datamigration/resource-manager/v2018_03_31_preview/pom.xml )| `com.microsoft.azure.datamigration.v2018_03_31_preview` | N/A | N/A | +| [`azure-mgmt-datamigration`]( datamigration/resource-manager/v2018_07_15_preview/pom.xml )| `com.microsoft.azure.datamigration.v2018_07_15_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.datamigration.v2018_07_15_preview/azure-mgmt-datamigration ) | +| [`azure-mgmt-devspaces`]( devspaces/resource-manager/v2018_06_01_preview/pom.xml )| `com.microsoft.azure.devspaces.v2018_06_01_preview` | N/A | N/A | +| [`azure-mgmt-devtestlabs`]( devtestlabs/resource-manager/v2018_09_15/pom.xml )| `com.microsoft.azure.devtestlabs.v2018_09_15` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.devtestlabs.v2018_09_15/azure-mgmt-devtestlabs ) | +| [`azure-mgmt-dns`]( dns/resource-manager/v2016_04_01/pom.xml )| `com.microsoft.azure.dns.v2016_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.dns.v2016_04_01/azure-mgmt-dns ) | +| [`azure-mgmt-eventgrid`]( eventgrid/resource-manager/v2019_06_01/pom.xml )| `com.microsoft.azure.eventgrid.v2019_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.eventgrid.v2019_06_01/azure-mgmt-eventgrid ) | +| [`azure-mgmt-eventgrid`]( eventgrid/resource-manager/v2018_05_01_preview/pom.xml )| `com.microsoft.azure.eventgrid.v2018_05_01_preview` | N/A | N/A | +| [`azure-mgmt-eventgrid`]( eventgrid/resource-manager/v2018_09_15_preview/pom.xml )| `com.microsoft.azure.eventgrid.v2018_09_15_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.eventgrid.v2018_09_15_preview/azure-mgmt-eventgrid ) | +| [`azure-mgmt-eventgrid`]( eventgrid/resource-manager/v2018_01_01/pom.xml )| `com.microsoft.azure.eventgrid.v2018_01_01` | N/A | N/A | +| [`azure-mgmt-eventgrid`]( eventgrid/resource-manager/v2019_01_01/pom.xml )| `com.microsoft.azure.eventgrid.v2019_01_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.eventgrid.v2019_01_01/azure-mgmt-eventgrid ) | +| [`azure-mgmt-eventhubs`]( eventhubs/resource-manager/v2017_04_01/pom.xml )| `com.microsoft.azure.eventhubs.v2017_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.eventhubs.v2017_04_01/azure-mgmt-eventhubs ) | +| [`azure-mgmt-eventhubs`]( eventhubs/resource-manager/v2018_01_01_preview/pom.xml )| `com.microsoft.azure.eventhubs.v2018_01_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.eventhubs.v2018_01_01_preview/azure-mgmt-eventhubs ) | +| [`azure-mgmt-eventhubs`]( eventhubs/resource-manager/v2015_08_01/pom.xml )| `com.microsoft.azure.eventhubs.v2015_08_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.eventhubs.v2015_08_01/azure-mgmt-eventhubs ) | +| [`azure-mgmt-features`]( features/resource-manager/v2015_12_01/pom.xml )| `com.microsoft.azure.features.v2015_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.features.v2015_12_01/azure-mgmt-features ) | +| [`azure-mgmt-hanaonazure`]( hanaonazure/resource-manager/v2017_11_03_preview/pom.xml )| `com.microsoft.azure.hanaonazure.v2017_11_03_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.hanaonazure.v2017_11_03_preview/azure-mgmt-hanaonazure ) | +| [`azure-mgmt-hdinsight`]( hdinsight/resource-manager/v2018_06_01_preview/pom.xml )| `com.microsoft.azure.hdinsight.v2018_06_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.hdinsight.v2018_06_01_preview/azure-mgmt-hdinsight ) | +| [`azure-mgmt-insights`]( applicationinsights/resource-manager/v2015_05_01/pom.xml )| `com.microsoft.azure.applicationinsights.v2015_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.applicationinsights.v2015_05_01/azure-mgmt-insights ) | +| [`azure-mgmt-iotcentral`]( iotcentral/resource-manager/v2018_09_01/pom.xml )| `com.microsoft.azure.iotcentral.v2018_09_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.iotcentral.v2018_09_01/azure-mgmt-iotcentral ) | +| [`azure-mgmt-iotcentral`]( iotcentral/resource-manager/v2017_07_01_privatepreview/pom.xml )| `com.microsoft.azure.iotcentral.v2017_07_01_privatepreview` | N/A | N/A | +| [`azure-mgmt-iothub`]( iothub/resource-manager/v2018_12_01_preview/pom.xml )| `com.microsoft.azure.iothub.v2018_12_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.iothub.v2018_12_01_preview/azure-mgmt-iothub ) | +| [`azure-mgmt-iothub`]( iothub/resource-manager/v2018_04_01/pom.xml )| `com.microsoft.azure.iothub.v2018_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.iothub.v2018_04_01/azure-mgmt-iothub ) | +| [`azure-mgmt-iothub`]( iothub/resource-manager/v2019_03_22_preview/pom.xml )| `com.microsoft.azure.iothub.v2019_03_22_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.iothub.v2019_03_22_preview/azure-mgmt-iothub ) | +| [`azure-mgmt-keyvault`]( keyvault/resource-manager/v2016_10_01/pom.xml )| `com.microsoft.azure.keyvault.v2016_10_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.keyvault.v2016_10_01/azure-mgmt-keyvault ) | +| [`azure-mgmt-keyvault`]( keyvault/resource-manager/v2015_06_01/pom.xml )| `com.microsoft.azure.keyvault.v2015_06_01` | N/A | N/A | +| [`azure-mgmt-kusto`]( kusto/resource-manager/v2018_09_07_preview/pom.xml )| `com.microsoft.azure.kusto.v2018_09_07_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.kusto.v2018_09_07_preview/azure-mgmt-kusto ) | +| [`azure-mgmt-kusto`]( kusto/resource-manager/v2019_05_15/pom.xml )| `com.microsoft.azure.kusto.v2019_05_15` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.kusto.v2019_05_15/azure-mgmt-kusto ) | +| [`azure-mgmt-labservices`]( labservices/resource-manager/v2018_10_15/pom.xml )| `com.microsoft.azure.labservices.v2018_10_15` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.labservices.v2018_10_15/azure-mgmt-labservices ) | +| [`azure-mgmt-locks`]( locks/resource-manager/v2016_09_01/pom.xml )| `com.microsoft.azure.locks.v2016_09_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.locks.v2016_09_01/azure-mgmt-locks ) | +| [`azure-mgmt-loganalytics`]( loganalytics/resource-manager/v2015_03_20/pom.xml )| `com.microsoft.azure.loganalytics.v2015_03_20` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.loganalytics.v2015_03_20/azure-mgmt-loganalytics ) | +| [`azure-mgmt-logic`]( logic/resource-manager/v2016_06_01/pom.xml )| `com.microsoft.azure.logic.v2016_06_01` | N/A | N/A | +| [`azure-mgmt-logic`]( logic/resource-manager/v2018_07_01_preview/pom.xml )| `com.microsoft.azure.logic.v2018_07_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.logic.v2018_07_01_preview/azure-mgmt-logic ) | +| [`azure-mgmt-machinelearningservices`]( machinelearningservices/resource-manager/v2019_05_01/pom.xml )| `com.microsoft.azure.machinelearningservices.v2019_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.machinelearningservices.v2019_05_01/azure-mgmt-machinelearningservices ) | +| [`azure-mgmt-mariadb`]( mariadb/resource-manager/v2018_06_01/pom.xml )| `com.microsoft.azure.mariadb.v2018_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mariadb.v2018_06_01/azure-mgmt-mariadb ) | +| [`azure-mgmt-marketplaceordering`]( marketplaceordering/resource-manager/v2015_06_01/pom.xml )| `com.microsoft.azure.marketplaceordering.v2015_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.marketplaceordering.v2015_06_01/azure-mgmt-marketplaceordering ) | +| [`azure-mgmt-media`]( mediaservices/resource-manager/v2018_07_01/pom.xml )| `com.microsoft.azure.mediaservices.v2018_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mediaservices.v2018_07_01/azure-mgmt-media ) | +| [`azure-mgmt-media`]( mediaservices/resource-manager/v2018_06_01_preview/pom.xml )| `com.microsoft.azure.mediaservices.v2018_06_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mediaservices.v2018_06_01_preview/azure-mgmt-media ) | +| [`azure-mgmt-media`]( mediaservices/resource-manager/v2015_10_01/pom.xml )| `com.microsoft.azure.mediaservices.v2015_10_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mediaservices.v2015_10_01/azure-mgmt-media ) | +| [`azure-mgmt-media`]( mediaservices/resource-manager/v2018_03_30_preview/pom.xml )| `com.microsoft.azure.mediaservices.v2018_03_30_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mediaservices.v2018_03_30_preview/azure-mgmt-media ) | +| [`azure-mgmt-mixedreality`]( mixedreality/resource-manager/v2019_02_28_preview/pom.xml )| `com.microsoft.azure.mixedreality.v2019_02_28_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mixedreality.v2019_02_28_preview/azure-mgmt-mixedreality ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2017_04_01/pom.xml )| `com.microsoft.azure.monitor.v2017_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2017_04_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2018_04_16/pom.xml )| `com.microsoft.azure.monitor.v2018_04_16` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2018_04_16/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2016_03_01/pom.xml )| `com.microsoft.azure.monitor.v2016_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2016_03_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2017_05_01_preview/pom.xml )| `com.microsoft.azure.monitor.v2017_05_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2017_05_01_preview/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2018_09_01/pom.xml )| `com.microsoft.azure.monitor.v2018_09_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2018_09_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2015_04_01/pom.xml )| `com.microsoft.azure.monitor.v2015_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2015_04_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2018_03_01/pom.xml )| `com.microsoft.azure.monitor.v2018_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2018_03_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2015_07_01/pom.xml )| `com.microsoft.azure.monitor.v2015_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2015_07_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2018_01_01/pom.xml )| `com.microsoft.azure.monitor.v2018_01_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2018_01_01/azure-mgmt-monitor ) | +| [`azure-mgmt-monitor`]( monitor/resource-manager/v2017_03_01_preview/pom.xml )| `com.microsoft.azure.monitor.v2017_03_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.monitor.v2017_03_01_preview/azure-mgmt-monitor ) | +| [`azure-mgmt-mysql`]( mysql/resource-manager/v2017_12_01/pom.xml )| `com.microsoft.azure.mysql.v2017_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mysql.v2017_12_01/azure-mgmt-mysql ) | +| [`azure-mgmt-mysql`]( mysql/resource-manager/v2017_12_01_preview/pom.xml )| `com.microsoft.azure.mysql.v2017_12_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.mysql.v2017_12_01_preview/azure-mgmt-mysql ) | +| [`azure-mgmt-netapp`]( netapp/resource-manager/v2017_08_15/pom.xml )| `com.microsoft.azure.netapp.v2017_08_15` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.netapp.v2017_08_15/azure-mgmt-netapp ) | +| [`azure-mgmt-netapp`]( netapp/resource-manager/v2019_05_01/pom.xml )| `com.microsoft.azure.netapp.v2019_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.netapp.v2019_05_01/azure-mgmt-netapp ) | +| [`azure-mgmt-netapp`]( netapp/resource-manager/v2019_07_01/pom.xml )| `com.microsoft.azure.netapp.v2019_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.netapp.v2019_07_01/azure-mgmt-netapp ) | +| [`azure-mgmt-netapp`]( netapp/resource-manager/v2019_06_01/pom.xml )| `com.microsoft.azure.netapp.v2019_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.netapp.v2019_06_01/azure-mgmt-netapp ) | +| [`azure-mgmt-network`]( network/resource-manager/v2018_12_01/pom.xml )| `com.microsoft.azure.network.v2018_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2018_12_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2018_04_01/pom.xml )| `com.microsoft.azure.network.v2018_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2018_04_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( dns/resource-manager/v2017_10_01/pom.xml )| `com.microsoft.azure.dns.v2017_10_01` | N/A | N/A | +| [`azure-mgmt-network`]( network/resource-manager/v2019_04_01/pom.xml )| `com.microsoft.azure.network.v2019_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2019_04_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2019_08_01/pom.xml )| `com.microsoft.azure.network.v2019_08_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2019_08_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2018_07_01/pom.xml )| `com.microsoft.azure.network.v2018_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2018_07_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2019_07_01/pom.xml )| `com.microsoft.azure.network.v2019_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2019_07_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2019_06_01/pom.xml )| `com.microsoft.azure.network.v2019_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2019_06_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2018_08_01/pom.xml )| `com.microsoft.azure.network.v2018_08_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2018_08_01/azure-mgmt-network ) | +| [`azure-mgmt-network`]( network/resource-manager/v2018_06_01/pom.xml )| `com.microsoft.azure.network.v2018_06_01` | N/A | N/A | +| [`azure-mgmt-network`]( network/resource-manager/v2017_10_01/pom.xml )| `com.microsoft.azure.network.v2017_10_01` | N/A | N/A | +| [`azure-mgmt-network`]( network/resource-manager/v2019_02_01/pom.xml )| `com.microsoft.azure.network.v2019_02_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.network.v2019_02_01/azure-mgmt-network ) | +| [`azure-mgmt-notificationhubs`]( notificationhubs/resource-manager/v2017_04_01/pom.xml )| `com.microsoft.azure.notificationhubs.v2017_04_01` | N/A | N/A | +| [`azure-mgmt-notificationhubs`]( notificationhubs/resource-manager/v2014_09_01/pom.xml )| `com.microsoft.azure.notificationhubs.v2014_09_01` | N/A | N/A | +| [`azure-mgmt-notificationhubs`]( notificationhubs/resource-manager/v2016_03_01/pom.xml )| `com.microsoft.azure.notificationhubs.v2016_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.notificationhubs.v2016_03_01/azure-mgmt-notificationhubs ) | +| [`azure-mgmt-operationsmanagement`]( operationsmanagement/resource-manager/v2015_11_01_preview/pom.xml )| `com.microsoft.azure.operationsmanagement.v2015_11_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.operationsmanagement.v2015_11_01_preview/azure-mgmt-operationsmanagement ) | +| [`azure-mgmt-peering`]( peering/resource-manager/v2019_08_01_preview/pom.xml )| `com.microsoft.azure.peering.v2019_08_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.peering.v2019_08_01_preview/azure-mgmt-peering ) | +| [`azure-mgmt-policy`]( policy/resource-manager/v2018_05_01/pom.xml )| `com.microsoft.azure.policy.v2018_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.policy.v2018_05_01/azure-mgmt-policy ) | +| [`azure-mgmt-policy`]( policy/resource-manager/v2018_03_01/pom.xml )| `com.microsoft.azure.policy.v2018_03_01` | N/A | N/A | +| [`azure-mgmt-policy`]( policy/resource-manager/v2016_12_01/pom.xml )| `com.microsoft.azure.policy.v2016_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.policy.v2016_12_01/azure-mgmt-policy ) | +| [`azure-mgmt-policy`]( policy/resource-manager/v2019_06_01/pom.xml )| `com.microsoft.azure.policy.v2019_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.policy.v2019_06_01/azure-mgmt-policy ) | +| [`azure-mgmt-policyinsights`]( policyinsights/resource-manager/v2018_07_01_preview/pom.xml )| `com.microsoft.azure.policyinsights.v2018_07_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.policyinsights.v2018_07_01_preview/azure-mgmt-policyinsights ) | +| [`azure-mgmt-policyinsights`]( policyinsights/resource-manager/v2018_04_04/pom.xml )| `com.microsoft.azure.policyinsights.v2018_04_04` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.policyinsights.v2018_04_04/azure-mgmt-policyinsights ) | +| [`azure-mgmt-postgresql`]( postgresql/resource-manager/v2017_12_01/pom.xml )| `com.microsoft.azure.postgresql.v2017_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.postgresql.v2017_12_01/azure-mgmt-postgresql ) | +| [`azure-mgmt-postgresql`]( postgresql/resource-manager/v2017_12_01_preview/pom.xml )| `com.microsoft.azure.postgresql.v2017_12_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.postgresql.v2017_12_01_preview/azure-mgmt-postgresql ) | +| [`azure-mgmt-privatedns`]( privatedns/resource-manager/v2018_09_01/pom.xml )| `com.microsoft.azure.privatedns.v2018_09_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.privatedns.v2018_09_01/azure-mgmt-privatedns ) | +| [`azure-mgmt-recoveryservices`]( recoveryservices.backup/resource-manager/v2017_07_01/pom.xml )| `com.microsoft.azure.recoveryservices.backup.v2017_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.recoveryservices.backup.v2017_07_01/azure-mgmt-recoveryservices ) | +| [`azure-mgmt-recoveryservices`]( recoveryservices/resource-manager/v2016_06_01/pom.xml )| `com.microsoft.azure.recoveryservices.v2016_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.recoveryservices.v2016_06_01/azure-mgmt-recoveryservices ) | +| [`azure-mgmt-recoveryservices`]( recoveryservices.backup/resource-manager/v2016_12_01/pom.xml )| `com.microsoft.azure.recoveryservices.backup.v2016_12_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.recoveryservices.backup.v2016_12_01/azure-mgmt-recoveryservices ) | +| [`azure-mgmt-recoveryservices`]( recoveryservices.backup/resource-manager/v2016_06_01/pom.xml )| `com.microsoft.azure.recoveryservices.backup.v2016_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.recoveryservices.backup.v2016_06_01/azure-mgmt-recoveryservices ) | +| [`azure-mgmt-recoveryservices`]( recoveryservices.siterecovery/resource-manager/v2018_01_10/pom.xml )| `com.microsoft.azure.recoveryservices.siterecovery.v2018_01_10` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.recoveryservices.siterecovery.v2018_01_10/azure-mgmt-recoveryservices ) | +| [`azure-mgmt-recoveryservices`]( recoveryservices.backup/resource-manager/v2016_08_10/pom.xml )| `com.microsoft.azure.recoveryservices.backup.v2016_08_10` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.recoveryservices.backup.v2016_08_10/azure-mgmt-recoveryservices ) | +| [`azure-mgmt-redis`]( redis/resource-manager/v2018_03_01/pom.xml )| `com.microsoft.azure.redis.v2018_03_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.redis.v2018_03_01/azure-mgmt-redis ) | +| [`azure-mgmt-relay`]( relay/resource-manager/v2017_04_01/pom.xml )| `com.microsoft.azure.relay.v2017_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.relay.v2017_04_01/azure-mgmt-relay ) | +| [`azure-mgmt-resourcegraph`]( resourcegraph/resource-manager/v2019_04_01/pom.xml )| `com.microsoft.azure.resourcegraph.v2019_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resourcegraph.v2019_04_01/azure-mgmt-resourcegraph ) | +| [`azure-mgmt-resourcehealth`]( resourcehealth/resource-manager/v2015_01_01/pom.xml )| `com.microsoft.azure.resourcehealth.v2015_01_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resourcehealth.v2015_01_01/azure-mgmt-resourcehealth ) | +| [`azure-mgmt-resourcehealth`]( resourcehealth/resource-manager/v2017_07_01/pom.xml )| `com.microsoft.azure.resourcehealth.v2017_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resourcehealth.v2017_07_01/azure-mgmt-resourcehealth ) | +| [`azure-mgmt-resources`]( resources/resource-manager/v2019_06_01/pom.xml )| `com.microsoft.azure.resources.v2019_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2019_06_01/azure-mgmt-resources ) | +| [`azure-mgmt-resources`]( resources/resource-manager/v2016_09_01/pom.xml )| `com.microsoft.azure.resources.v2016_09_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2016_09_01/azure-mgmt-resources ) | +| [`azure-mgmt-resources`]( resources/resource-manager/v2019_05_01/pom.xml )| `com.microsoft.azure.resources.v2019_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2019_05_01/azure-mgmt-resources ) | +| [`azure-mgmt-resources`]( resources/resource-manager/v2018_05_01/pom.xml )| `com.microsoft.azure.resources.v2018_05_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2018_05_01/azure-mgmt-resources ) | +| [`azure-mgmt-resources`]( resources/resource-manager/v2018_02_01/pom.xml )| `com.microsoft.azure.resources.v2018_02_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2018_02_01/azure-mgmt-resources ) | +| [`azure-mgmt-resources`]( resources/resource-manager/v2019_07_01/pom.xml )| `com.microsoft.azure.resources.v2019_07_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2019_07_01/azure-mgmt-resources ) | +| [`azure-mgmt-search`]( search/resource-manager/v2015_02_28/pom.xml )| `com.microsoft.azure.search.v2015_02_28` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.search.v2015_02_28/azure-mgmt-search ) | +| [`azure-mgmt-servicebus`]( servicebus/resource-manager/v2017_04_01/pom.xml )| `com.microsoft.azure.servicebus.v2017_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.servicebus.v2017_04_01/azure-mgmt-servicebus ) | +| [`azure-mgmt-servicebus`]( servicebus/resource-manager/v2015_08_01/pom.xml )| `com.microsoft.azure.servicebus.v2015_08_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.servicebus.v2015_08_01/azure-mgmt-servicebus ) | +| [`azure-mgmt-servicebus`]( servicebus/resource-manager/v2018_01_01_preview/pom.xml )| `com.microsoft.azure.servicebus.v2018_01_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.servicebus.v2018_01_01_preview/azure-mgmt-servicebus ) | +| [`azure-mgmt-servicefabric`]( servicefabric/resource-manager/v2018_02_01/pom.xml )| `com.microsoft.azure.servicefabric.v2018_02_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.servicefabric.v2018_02_01/azure-mgmt-servicefabric ) | +| [`azure-mgmt-signalr`]( signalr/resource-manager/v2018_03_01_preview/pom.xml )| `com.microsoft.azure.azure-mgmt-signalr-2018-03-01-preview` | N/A | N/A | +| [`azure-mgmt-signalr`]( signalr/resource-manager/v2018_10_01/pom.xml )| `com.microsoft.azure.signalr.v2018_10_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.signalr.v2018_10_01/azure-mgmt-signalr ) | +| [`azure-mgmt-sql`]( sql/resource-manager/v2017_10_01_preview/pom.xml )| `com.microsoft.azure.sql.v2017_10_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.sql.v2017_10_01_preview/azure-mgmt-sql ) | +| [`azure-mgmt-sql`]( sql/resource-manager/v2018_06_01_preview/pom.xml )| `com.microsoft.azure.sql.v2018_06_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.sql.v2018_06_01_preview/azure-mgmt-sql ) | +| [`azure-mgmt-sql`]( sql/resource-manager/v2015_05_01_preview/pom.xml )| `com.microsoft.azure.sql.v2015_05_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.sql.v2015_05_01_preview/azure-mgmt-sql ) | +| [`azure-mgmt-sql`]( sql/resource-manager/v2017_03_01_preview/pom.xml )| `com.microsoft.azure.sql.v2017_03_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.sql.v2017_03_01_preview/azure-mgmt-sql ) | +| [`azure-mgmt-sql`]( sql/resource-manager/v2014_04_01/pom.xml )| `com.microsoft.azure.sql.v2014_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.sql.v2014_04_01/azure-mgmt-sql ) | +| [`azure-mgmt-sqlvirtualmachine`]( sqlvirtualmachine/resource-manager/v2017_03_01_preview/pom.xml )| `com.microsoft.azure.sqlvirtualmachine.v2017_03_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.sqlvirtualmachine.v2017_03_01_preview/azure-mgmt-sqlvirtualmachine ) | +| [`azure-mgmt-storage`]( storage/resource-manager/v2018_03_01_preview/pom.xml )| `com.microsoft.azure.storage.v2018_03_01_preview` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.storage.v2018_03_01_preview/azure-mgmt-storage ) | +| [`azure-mgmt-storage`]( storage/resource-manager/v2018_02_01/pom.xml )| `com.microsoft.azure.storage.v2018_02_01` | N/A | N/A | +| [`azure-mgmt-storage`]( storage/resource-manager/v2016_01_01/pom.xml )| `com.microsoft.azure.storage.v2016_01_01` | N/A | N/A | +| [`azure-mgmt-storage`]( storage/resource-manager/v2018_07_01/pom.xml )| `com.microsoft.azure.storage.v2018_07_01` | N/A | N/A | +| [`azure-mgmt-storage`]( storage/resource-manager/v2017_10_01/pom.xml )| `com.microsoft.azure.storage.v2017_10_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.storage.v2017_10_01/azure-mgmt-storage ) | +| [`azure-mgmt-storage`]( storage/resource-manager/v2019_04_01/pom.xml )| `com.microsoft.azure.storage.v2019_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.storage.v2019_04_01/azure-mgmt-storage ) | +| [`azure-mgmt-storage`]( storage/resource-manager/v2018_11_01/pom.xml )| `com.microsoft.azure.storage.v2018_11_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.storage.v2018_11_01/azure-mgmt-storage ) | +| [`azure-mgmt-storagecache`]( storagecache/resource-manager/v2019_08_01/pom.xml )| `com.microsoft.azure.storagecache.v2019_08_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.storagecache.v2019_08_01/azure-mgmt-storagecache ) | +| [`azure-mgmt-storageimportexport`]( storageimportexport/resource-manager/v2016_11_01/pom.xml )| `com.microsoft.azure.storageimportexport.v2016_11_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.storageimportexport.v2016_11_01/azure-mgmt-storageimportexport ) | +| [`azure-mgmt-streamanalytics`]( streamanalytics/resource-manager/v2016_03_01/pom.xml )| `com.microsoft.azure.streamanalytics.v2016_03_01` | N/A | N/A | +| [`azure-mgmt-subscriptions`]( resources/resource-manager/v2016_06_01/pom.xml )| `com.microsoft.azure.resources.v2016_06_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.resources.v2016_06_01/azure-mgmt-subscriptions ) | +| [`azure-mgmt-vmwarecloudsimple`]( vmwarecloudsimple/resource-manager/v2019_04_01/pom.xml )| `com.microsoft.azure.vmwarecloudsimple.v2019_04_01` | N/A | [Maven]( https://search.maven.org/artifact/com.microsoft.azure.vmwarecloudsimple.v2019_04_01/azure-mgmt-vmwarecloudsimple ) | diff --git a/pom.client.xml b/pom.client.xml index 5f80c0d5bbc1..fb966de07912 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -457,6 +457,10 @@ Azure Storage Blobs - Cryptography com.azure.storage.blob.cryptography* + + Azure Storage Blobs - NIO + com.azure.storage.blob.nio* + Azure Storage - Files com.azure.storage.file* @@ -474,6 +478,10 @@ Azure Telemetry - OpenCensus com.azure.core.tracing* + + Azure Text Analytics + com.azure.ai.textanalytics* + https://docs.oracle.com/javase/8/docs/api/ @@ -647,6 +655,7 @@ -snippetpath ${project.basedir}/sdk/storage/azure-storage-common/src/samples/java -snippetpath ${project.basedir}/sdk/storage/azure-storage-file-share/src/samples/java -snippetpath ${project.basedir}/sdk/storage/azure-storage-queue/src/samples/java + -snippetpath ${project.basedir}/sdk/textanalytics/azure-ai-textanalytics/src/samples/java all @@ -1063,7 +1072,7 @@ - + @@ -1223,6 +1232,7 @@ sdk/core/azure-core-test sdk/core/azure-core-tracing-opencensus sdk/core/azure-core-tracing-opentelemetry + sdk/e2e sdk/eventhubs/azure-messaging-eventhubs sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob sdk/identity/azure-identity @@ -1232,10 +1242,11 @@ sdk/storage/azure-storage-blob sdk/storage/azure-storage-blob-batch sdk/storage/azure-storage-blob-cryptography + sdk/storage/azure-storage-blob-nio sdk/storage/azure-storage-common sdk/storage/azure-storage-file-share sdk/storage/azure-storage-file-datalake sdk/storage/azure-storage-queue - sdk/e2e + sdk/textanalytics/azure-ai-textanalytics diff --git a/pom.xml b/pom.xml index 4d0980f2dbd5..9d85456a4b17 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ com.azure azure-sdk-parent - 1.6.0 1.6.0 + 1.6.0 ./parent/pom.xml @@ -105,7 +105,6 @@ - org.apache.maven.plugins diff --git a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md index 1e78d0790f07..86755c86f0a2 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md @@ -1,16 +1,24 @@ -# Change Log azure-data-appconfiguration -## Version 1.0.0-preview.7 (2019-11-26) -For details on the Azure SDK for Java (November 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview7-java). +# Release History +## 1.0.1 (2020-01-06) +- Added support for setting `x-ms-client-request-id`, `x-ms-correlation-request-id` and `correlation-context` http header values. +- Fixed `UserAgent` unknown name and unknown version bug. +- Fixed `connectionString()`, it throws `IllegalArgumentException` error when `connectionString` is an empty string, + the secret contained within the connection string is invalid or the HMAC-SHA256 MAC algorithm cannot be instantiated. +- No longer set `TokenCredential` to null when `connectionString` is given, or visa versa. + +### Breaking changes +- SettingSelector takes a filter instead of taking a list of strings. Supported `SettingSelector` literal special character and wild card functions. + +## 1.0.0-beta.7 (2019-11-26) - Added support for Azure Activity Directory authentication. - Added service API version support -#### Breaking Changes +### Breaking Changes - Removed clearReadOnly API, updated setReadOnly API to support setting and clearing read only based on the flag passed. - Removed Range class, SettingSelector no longer supports Range. -## Version 1.0.0-preview.6 (2019-10-31) -For details on the Azure SDK for Java (October 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview6-java). +## 1.0.0-preview.6 (2019-10-31) - Renamed addSetting, getSetting, deleteSetting, setSetting, listSettings, listSettingRevisions to addConfigurationSetting, getConfigurationSetting, deleteConfigurationSetting, setConfigurationSetting, listConfigurationSettings, listRevisions for consistency naming across languages. @@ -26,9 +34,7 @@ This package's and [samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) -## Version 1.0.0-preview.5 (2019-10-11) -For details on the Azure SDK for Java (September 2019 Preview) release refer to the [release announcement](https://azure.github.io/azure-sdk/releases/2019-10-11/java.html). - +## 1.0.0-preview.5 (2019-10-11) - Fixed a explored bug that ConfigurationClientCredential is already pacakge-private. Using connection String instead. This package's @@ -37,9 +43,7 @@ and [samples](https://github.com/Azure/azure-sdk-for-java/tree/4375acbb70d4b85db238d6b5147b697d9355f45e/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) demonstrate the new API. -## Version 1.0.0-preview.4 (2019-10-8) -For details on the Azure SDK for Java (October 2019 Preview) release refer to the [release announcement](https://azure.github.io/azure-sdk/releases/2019-10-11/java.html). - +## 1.0.0-preview.4 (2019-10-8) - Updated addSetting, getSetting, deleteSetting, setSetting to support conditional request. - Removed UpdateSetting. - Allowed user to define custom equality of configuration setting. @@ -52,9 +56,7 @@ and [samples](https://github.com/Azure/azure-sdk-for-java/tree/4375acbb70d4b85db238d6b5147b697d9355f45e/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) demonstrate the new API. -## Version 1.0.0-preview.3 (2019-09-10) -For details on the Azure SDK for Java (September 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). - +## 1.0.0-preview.3 (2019-09-10) - Removed dependency on Netty. - Added logging when throwing `RutimeException`s. @@ -64,9 +66,7 @@ and [samples](https://github.com/Azure/azure-sdk-for-java/tree/4375acbb70d4b85db238d6b5147b697d9355f45e/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) demonstrate the new API. -## Version 1.0.0-preview.2 (2019-08-06) -For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). - +## 1.0.0-preview.2 (2019-08-06) - Merged ConfigurationClientBuilder and ConfigurationAsyncClientBuilder into ConfigurationClientBuilder. Method to build each client were added. - ConfigurationClientBuilder was made instantiable, static builder method removed from ConfigurationClient and ConfigurationAsyncClient. - Builder method credentials renamed to credential and serviceEndpoint to endpoint. @@ -83,13 +83,11 @@ and [samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-data-appconfiguration_1.0.0-preview.2/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) demonstrate the new API. -## Version 1.0.0-preview.1 (2019-06-28) +## 1.0.0-preview.1 (2019-06-28) Version 1.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). -For details on the Azure SDK for Java (July 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview1-java). - This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-data-appconfiguration_1.0.0-preview.1/appconfiguration/client/README.md) and diff --git a/sdk/appconfiguration/azure-data-appconfiguration/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index 52820c3b0f3a..cca9820f3354 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -23,7 +23,7 @@ Use the client library for App Configuration to create and manage application co com.azure azure-data-appconfiguration - 1.0.0-preview.6 + 1.0.1 ``` [//]: # ({x-version-update-end}) @@ -37,7 +37,7 @@ AppConfiguration to use Netty HTTP client. com.azure azure-core-http-netty - 1.0.0 + 1.2.0 ``` [//]: # ({x-version-update-end}) @@ -52,7 +52,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-data-appconfiguration - 1.0.0-preview.6 + 1.0.1 com.azure @@ -67,7 +67,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-core-http-okhttp - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) @@ -77,6 +77,7 @@ When an HTTP client is included on the classpath, as shown above, it is not nece For starters, by having the Netty or OkHTTP dependencies on your classpath, as shown above, you can create new instances of these `HttpClient` types using their builder APIs. For example, here is how you would create a Netty HttpClient instance: + ```java HttpClient client = new NettyAsyncHttpClientBuilder() .port(8080) @@ -107,7 +108,9 @@ az appconfig create --name --resource-group Alternatively, get the connection string from the Azure Portal. -#### Create a Configuration Client +##### Create a Configuration Client Once you have the value of the connection string you can create the configuration client: + ```Java -ConfigurationClient client = new ConfigurationClientBuilder() - .connectionString(connectionString) - .buildClient(); +ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildClient(); ``` or + ```Java -ConfigurationAsyncClient client = new ConfigurationClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); +ConfigurationAsyncClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); ``` -You can also use `TokenCredential` to create a configuration client, such as an Azure Active Directory (AAD) token. -Unlike a connection string if you're using an AAD token you must supply the endpoint of AppConfiguration service. The -endpoint can be obtained by going to your App Configuration instance in the Azure portal and navigating to "Overview" -page and look for the "Endpoint" keyword. +#### Use AAD token -```Java -// An example of using TokenCredential and Endpoint to create a synchronous client -TokenCredential credential = new DefaultAzureCredential(); +Here we demonstrate using [DefaultAzureCredential][default_cred_ref] +to authenticate as a service principal. However, the configuration client +accepts any [azure-identity][azure_identity] credential. See the +[azure-identity][azure_identity] documentation for more information about other +credentials. + +##### Create a service principal (optional) +This [Azure CLI][azure_cli] snippet shows how to create a +new service principal. Before using it, replace "your-application-name" with +the appropriate name for your service principal. + +Create a service principal: +```Bash +az ad sp create-for-rbac --name http://my-application --skip-assignment +``` + +Output: +```json + { + "appId": "generated app id", + "displayName": "my-application", + "name": "http://my-application", + "password": "random password", + "tenant": "tenant id" + } +``` + +Use the output to set **AZURE_CLIENT_ID** ("appId" above), **AZURE_CLIENT_SECRET** +("password" above) and **AZURE_TENANT_ID** ("tenant" above) environment variables. +The following example shows a way to do this in Bash: +```Bash +export AZURE_CLIENT_ID="generated app id" +export AZURE_CLIENT_SECRET="random password" +export AZURE_TENANT_ID="tenant id" +``` -ConfigurationClient client = new ConfigurationClientBuilder() - .credential(credential) - .endpoint(endpoint) - .buildClient(); +Assign one of the applicable [App Configuration roles][app_config_role] to the service principal. + +##### Create a client +Once the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and +**AZURE_TENANT_ID** environment variables are set, +[DefaultAzureCredential][default_cred_ref] will be able to authenticate the +configuration client. + +Constructing the client also requires your configuration store's URL, which you can +get from the Azure CLI or the Azure Portal. In the Azure Portal, the URL can be found listed as the service "Endpoint" + + +```Java +DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); +ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .credential(credential) + .endpoint(endpoint) + .buildClient(); ``` ## Key concepts @@ -164,30 +212,39 @@ The client performs the interactions with the App Configuration service, getting An application that needs to retrieve startup configurations is better suited using the synchronous client, for example setting up a SQL connection. + ```Java -ConfigurationClient client = new ConfigurationClientBuilder() - .connectionString(connectionString) - .buildClient(); +ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildClient(); // urlLabel is optional -String url = client.getConfigurationSetting(urlKey, urlLabel).getValue(); -Connection conn; +String url = configurationClient.getConfigurationSetting(urlKey, urlLabel).getValue(); +Connection conn = null; try { conn = DriverManager.getConnection(url); } catch (SQLException ex) { System.out.printf("Failed to get connection using url %s", url); +} finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException ex) { + System.out.printf("Failed to close connection, url %s", url); + } + } } - ``` An application that has a large set of configurations that it needs to periodically update is be better suited using the asynchronous client, for example all settings with a specific label are periodically updated. + ```Java -ConfigurationAsyncClient client = new ConfigurationClientBuilder() - .connectionString(appConfigConnectionString) - .buildAsyncClient(); +ConfigurationAsyncClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); -client.listConfigurationSettings(new SettingSelector().setLabels(periodicUpdateLabel)) +configurationClient.listConfigurationSettings(new SettingSelector().setLabelFilter(periodicUpdateLabel)) .subscribe(setting -> updateConfiguration(setting)); ``` @@ -198,10 +255,12 @@ The following sections provide several code snippets covering some of the most c ### Create a Configuration Client Create a configuration client by using `ConfigurationClientBuilder` by passing connection string. + + ```Java -ConfigurationClient client = new ConfigurationClientBuilder() - .connectionString(connectionString) - .buildClient(); +ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildClient(); ``` ### Create a Configuration Setting @@ -209,96 +268,127 @@ ConfigurationClient client = new ConfigurationClientBuilder() Create a configuration setting to be stored in the configuration store. There are two ways to store a configuration setting: - `addConfigurationSetting` creates a setting only if the setting does not already exist in the store. + + ```Java ConfigurationSetting setting = configurationClient.addConfigurationSetting("new_key", "new_label", "new_value"); ``` + Or + - `setConfigurationSetting` creates a setting if it doesn't exist or overrides an existing setting. + + ```Java -ConfigurationSetting setting = client.setConfigurationSetting("some_key", "some_label", "some_value"); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); ``` ### Retrieve a Configuration Setting Retrieve a previously stored configuration setting by calling `getConfigurationSetting`. + + ```Java -ConfigurationSetting setting = client.setConfigurationSetting("some_key", "some_label", "some_value"); -ConfigurationSetting retrievedSetting = client.getConfigurationSetting("some_key", "some_label"); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +ConfigurationSetting retrievedSetting = configurationClient.getConfigurationSetting("some_key", "some_label"); ``` + For conditional request, if you want to conditionally fetch a configuration setting, set `ifChanged` to true. When `ifChanged` is true, the configuration setting is only retrieved if it is different than the given `setting`. This is determined by comparing the ETag of the `setting` to the one in the service to see if they are the same or not. If the ETags are not the same, it means the configuration setting is different, and its value is retrieved. + + ```Java -Response settingResponse = client.getConfigurationSettingWithResponse(setting, null, true, Context.NONE); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +Response settingResponse = configurationClient.getConfigurationSettingWithResponse(setting, null, true, Context.NONE); ``` ### Update an existing Configuration Setting Update an existing configuration setting by calling `setConfigurationSetting`. + + ```Java -ConfigurationSetting setting = client.setConfigurationSetting("some_key", "some_label", "some_value"); -ConfigurationSetting updatedSetting = client.setConfigurationSetting("some_key", "some_label", "new_value"); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +ConfigurationSetting updatedSetting = configurationClient.setConfigurationSetting("some_key", "some_label", "new_value"); ``` + For conditional request, if you want to conditionally update a configuration setting, set the `ifUnchanged` parameter to true. When `ifUnchanged` is true, the configuration setting is only updated if it is same as the given `setting`. This is determined by comparing the ETag of the `setting` to the one in the service to see if they are the same or not. If the ETag are the same, it means the configuration setting is same, and its value is updated. + + ```Java -Response settingResponse = client.setConfigurationSettingWithResponse(setting, true, Context.NONE); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +Response settingResponse = configurationClient.setConfigurationSettingWithResponse(setting, true, Context.NONE); ``` ### Delete a Configuration Setting Delete an existing configuration setting by calling `deleteConfigurationSetting`. + + ```Java -ConfigurationSetting setting = client.setConfigurationSetting("some_key", "some_label", "some_value"); -ConfigurationSetting deletedSetting = client.deleteConfigurationSetting("some_key", "some_label"); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +ConfigurationSetting deletedSetting = configurationClient.deleteConfigurationSetting("some_key", "some_label"); ``` For conditional request, if you want to conditionally delete a configuration setting, set the `ifUnchanged` parameter to true. When `ifUnchanged` parameter to true. When `ifUnchanged` is true, the configuration setting is only deleted if it is same as the given `setting`. This is determined by comparing the ETag of the `setting` to the one in the service to see if they are the same or not. If the ETag are same, it means the configuration setting is same, and its value is deleted. + + ```Java -Response settingResponse = client.deleteConfigurationSettingWithResponse(setting, true, Context.NONE); +ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +Response settingResponse = configurationClient.deleteConfigurationSettingWithResponse(setting, true, Context.NONE); ``` ### List Configuration Settings with multiple keys List multiple configuration settings by calling `listConfigurationSettings`. Pass a null `SettingSelector` into the method if you want to fetch all the configuration settings and their fields. + + ```Java String key = "some_key"; String key2 = "new_key"; -client.setConfigurationSetting(key, "some_label", "some_value"); -client.setConfigurationSetting(key2, "new_label", "new_value"); -SettingSelector selector = new SettingSelector().setKeys(key, key2); -PagedIterable settings = client.listConfigurationSettings(selector); +configurationClient.setConfigurationSetting(key, "some_label", "some_value"); +configurationClient.setConfigurationSetting(key2, "new_label", "new_value"); +SettingSelector selector = new SettingSelector().setKeyFilter(key + "," + key2); +PagedIterable settings = configurationClient.listConfigurationSettings(selector); ``` ### List revisions of multiple Configuration Settings List all revisions of a configuration setting by calling `listRevisions`. + + ```Java String key = "revisionKey"; -client.setConfigurationSetting(key, "some_label", "some_value"); -client.setConfigurationSetting(key, "new_label", "new_value"); -SettingSelector selector = new SettingSelector().setKeys(key); -PagedIterable settings = client.listRevisions(selector); +configurationClient.setConfigurationSetting(key, "some_label", "some_value"); +configurationClient.setConfigurationSetting(key, "new_label", "new_value"); +SettingSelector selector = new SettingSelector().setKeyFilter(key); +PagedIterable settings = configurationClient.listRevisions(selector); ``` ### Set a Configuration Setting to read only Set a configuration setting to read-only status. + + ```Java -client.setConfigurationSetting("some_key", "some_label", "some_value"); -ConfigurationSetting setting = client.setReadOnly("some_key", "some_label", true); +configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); +ConfigurationSetting setting = configurationClient.setReadOnly("some_key", "some_label", true); ``` ### Clear read only from a Configuration Setting Clear read-only from a configuration setting. + + ```Java -ConfigurationSetting setting = client.setReadOnly("some_key", "some_label", false); +ConfigurationSetting setting = configurationClient.setReadOnly("some_key", "some_label", false); ``` ## Troubleshooting @@ -309,17 +399,18 @@ When you interact with App Configuration using this Java client library, errors App Configuration provides a way to define customized headers through `Context` object in the public API. + ```java - // Add your headers - HttpHeaders headers = new HttpHeaders(); - headers.put("my-header1", "my-header1-value"); - headers.put("my-header2", "my-header2-value"); - headers.put("my-header3", "my-header3-value"); - // Call API by passing headers in Context. - configurationClient.addConfigurationSettingWithResponse( - new ConfigurationSetting().setKey("key").setValue("value"), - new Context(AddHeadersFromContextPolicy.AZURE_REQUEST_HTTP_HEADERS_KEY, headers)); - // Above three HttpHeader will be added in outgoing HttpRequest. +// Add your headers +HttpHeaders headers = new HttpHeaders(); +headers.put("my-header1", "my-header1-value"); +headers.put("my-header2", "my-header2-value"); +headers.put("my-header3", "my-header3-value"); +// Call API by passing headers in Context. +configurationClient.addConfigurationSettingWithResponse( + new ConfigurationSetting().setKey("key").setValue("value"), + new Context(AddHeadersFromContextPolicy.AZURE_REQUEST_HTTP_HEADERS_KEY, headers)); +// Above three HttpHeader will be added in outgoing HttpRequest. ``` For more detail information, check out the [AddHeadersFromContextPolicy][add_headers_from_context_policy] @@ -337,23 +428,26 @@ When you submit a pull request, a CLA-bot will automatically determine whether y 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 [opencode@microsoft.com][coc_contact] with any additional questions or comments. +[add_headers_from_context_policy]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersFromContextPolicy.java [api_documentation]: https://aka.ms/java-docs [app_config_store]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store +[app_config_role]: https://github.com/Azure/AppConfiguration/blob/master/docs/REST/authorization/aad.md [azconfig_docs]: https://docs.microsoft.com/azure/azure-app-configuration [azure_cli]: https://docs.microsoft.com/cli/azure +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/identity/azure-identity [azure_subscription]: https://azure.microsoft.com/free [cla]: https://cla.microsoft.com [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ [coc_contact]: mailto:opencode@microsoft.com +[default_cred_ref]: https://azuresdkdocs.blob.core.windows.net/$web/java/azure-identity/1.0.1/com/azure/identity/DefaultAzureCredential.html [maven]: https://maven.apache.org/ [package]: https://search.maven.org/artifact/com.azure/azure-data-appconfiguration +[performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning [rest_api]: https://github.com/Azure/AppConfiguration#rest-api-reference [samples]: src/samples/java/com/azure/data/appconfiguration [samples_readme]: src/samples/README.md [source_code]: src [spring_quickstart]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-java-spring-app -[performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning -[add_headers_from_context_policy]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersFromContextPolicy.java ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fappconfiguration%2Fazure-data-appconfiguration%2FREADME.png) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index d58d7284969a..0aa428df155f 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -13,7 +13,7 @@ com.azure azure-data-appconfiguration - 1.0.0-beta.8 + 1.0.1 Microsoft Azure client library for App Configuration This package contains the Microsoft Azure App Configuration client library. @@ -36,7 +36,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 org.slf4j @@ -53,7 +53,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java index 87b95161cf56..f51c0e273634 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java @@ -214,7 +214,7 @@ public Mono setConfigurationSetting(String key, String lab */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> setConfigurationSettingWithResponse(ConfigurationSetting setting, - boolean ifUnchanged) { + boolean ifUnchanged) { try { return withContext(context -> setConfigurationSetting(setting, ifUnchanged, context)); } catch (RuntimeException ex) { @@ -223,7 +223,7 @@ public Mono> setConfigurationSettingWithResponse( } Mono> setConfigurationSetting(ConfigurationSetting setting, boolean ifUnchanged, - Context context) { + Context context) { // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); @@ -324,8 +324,7 @@ public Mono getConfigurationSetting(String key, String lab */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getConfigurationSettingWithResponse(ConfigurationSetting setting, - OffsetDateTime acceptDateTime, - boolean ifChanged) { + OffsetDateTime acceptDateTime, boolean ifChanged) { try { return withContext(context -> getConfigurationSetting(setting, acceptDateTime, ifChanged, context)); } catch (RuntimeException ex) { @@ -334,9 +333,7 @@ public Mono> getConfigurationSettingWithResponse( } Mono> getConfigurationSetting(ConfigurationSetting setting, - OffsetDateTime acceptDateTime, - boolean onlyIfChanged, - Context context) { + OffsetDateTime acceptDateTime, boolean onlyIfChanged, Context context) { // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); @@ -419,7 +416,7 @@ public Mono deleteConfigurationSetting(String key, String */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteConfigurationSettingWithResponse(ConfigurationSetting setting, - boolean ifUnchanged) { + boolean ifUnchanged) { try { return withContext(context -> deleteConfigurationSetting(setting, ifUnchanged, context)); } catch (RuntimeException ex) { @@ -428,7 +425,7 @@ public Mono> deleteConfigurationSettingWithRespon } Mono> deleteConfigurationSetting(ConfigurationSetting setting, boolean ifUnchanged, - Context context) { + Context context) { // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); final String ifMatchETag = ifUnchanged ? getETagValue(setting.getETag()) : null; @@ -498,7 +495,7 @@ public Mono setReadOnly(String key, String label, boolean */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> setReadOnlyWithResponse(ConfigurationSetting setting, - boolean isReadOnly) { + boolean isReadOnly) { try { return withContext(context -> setReadOnly(setting, isReadOnly, context)); } catch (RuntimeException ex) { @@ -507,7 +504,7 @@ public Mono> setReadOnlyWithResponse(Configuratio } Mono> setReadOnly(ConfigurationSetting setting, boolean isReadOnly, - Context context) { + Context context) { // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index b4d1ad18e5e1..fb8d39df2453 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -67,7 +67,7 @@ * @see ConfigurationAsyncClient * @see ConfigurationClient */ -@ServiceClientBuilder(serviceClients = ConfigurationClient.class) +@ServiceClientBuilder(serviceClients = {ConfigurationAsyncClient.class, ConfigurationClient.class}) public final class ConfigurationClientBuilder { // This header tells the server to return the request id in the HTTP response. Useful for correlation with what @@ -239,25 +239,30 @@ public ConfigurationClientBuilder endpoint(String endpoint) { * @param connectionString Connection string in the format "endpoint={endpoint_value};id={id_value}; * secret={secret_value}" * @return The updated ConfigurationClientBuilder object. - * @throws NullPointerException If {@code credential} is {@code null}. + * @throws NullPointerException If {@code connectionString} is {@code null}. + * @throws IllegalArgumentException if {@code connectionString} is an empty string, the {@code connectionString} + * secret is invalid, or the HMAC-SHA256 MAC algorithm cannot be instantiated. */ public ConfigurationClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); + Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); + + if (connectionString.isEmpty()) { + throw logger.logExceptionAsError( + new IllegalArgumentException("'connectionString' cannot be an empty string.")); + } try { this.credential = new ConfigurationClientCredentials(connectionString); } catch (InvalidKeyException err) { throw logger.logExceptionAsError(new IllegalArgumentException( - "The secret is invalid and cannot instantiate the HMAC-SHA256 algorithm.", err)); + "The secret contained within the connection string is invalid and cannot instantiate the HMAC-SHA256" + + " algorithm.", err)); } catch (NoSuchAlgorithmException err) { throw logger.logExceptionAsError( new IllegalArgumentException("HMAC-SHA256 MAC algorithm cannot be instantiated.", err)); } this.endpoint = credential.getBaseUri(); - - // Clear TokenCredential in favor of connection string credential - this.tokenCredential = null; return this; } @@ -272,9 +277,6 @@ public ConfigurationClientBuilder credential(TokenCredential tokenCredential) { // token credential can not be null value Objects.requireNonNull(tokenCredential); this.tokenCredential = tokenCredential; - - // Clear connection string based credential in favor of TokenCredential - this.credential = null; return this; } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/README.md b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/README.md index 7c648a01bcef..cde109a068f8 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/README.md @@ -20,7 +20,7 @@ Maven dependency for Azure app configuration Client library. Add it to your proj com.azure azure-data-appconfiguration - 1.0.0-preview.6 + 1.0.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/AadAuthentication.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/AadAuthentication.java index cbe209e47f67..4a6e18f54096 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/AadAuthentication.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/AadAuthentication.java @@ -3,8 +3,8 @@ package com.azure.data.appconfiguration; -import com.azure.core.credential.TokenCredential; import com.azure.data.appconfiguration.models.ConfigurationSetting; +import com.azure.identity.DefaultAzureCredential; import com.azure.identity.DefaultAzureCredentialBuilder; /** @@ -21,9 +21,13 @@ public static void main(String[] args) { // and navigating to "Overview" page. Looking for the "Endpoint" keyword. String endpoint = "{endpoint_value}"; - // Token Credential could be an AAD token which you can get from Identity - // or other service authentication service. - TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); + // Default token credential could be obtained from Identity service. + // It tries to create a valid credential in the following order: + // EnvironmentCredential + // ManagedIdentityCredential + // SharedTokenCacheCredential + // Fails if none of the credentials above could be created. + DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) // AAD authentication diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ReadmeSamples.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ReadmeSamples.java new file mode 100644 index 000000000000..ee4c240675b0 --- /dev/null +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ReadmeSamples.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.appconfiguration; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.data.appconfiguration.models.ConfigurationSetting; +import com.azure.data.appconfiguration.models.SettingSelector; +import com.azure.identity.DefaultAzureCredential; +import com.azure.identity.DefaultAzureCredentialBuilder; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +/** + * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS + * ARE USED TO EXTRACT APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING + * LINE NUMBERS OF EXISTING CODE SAMPLES. + * + * Code samples for the README.md + */ +public class ReadmeSamples { + private String endpoint = "endpoint"; + private String connectionString = "connection string"; + private String urlKey = "url key"; + private String urlLabel = "url label"; + private String periodicUpdateLabel = "periodic update label"; + private ConfigurationClient configurationClient = new ConfigurationClientBuilder().buildClient(); + + public void createHttpClient() { + HttpClient client = new NettyAsyncHttpClientBuilder() + .port(8080) + .wiretap(true) + .build(); + } + + public void createClient() { + ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildClient(); + } + + public void createAsyncClient() { + ConfigurationAsyncClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + } + + public void aadAuthentication() { + DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .credential(credential) + .endpoint(endpoint) + .buildClient(); + } + + public void sqlExample() { + ConfigurationClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildClient(); + + // urlLabel is optional + String url = configurationClient.getConfigurationSetting(urlKey, urlLabel).getValue(); + Connection conn = null; + try { + conn = DriverManager.getConnection(url); + } catch (SQLException ex) { + System.out.printf("Failed to get connection using url %s", url); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException ex) { + System.out.printf("Failed to close connection, url %s", url); + } + } + } + } + + public void listConfigurationsExample() { + ConfigurationAsyncClient configurationClient = new ConfigurationClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + + configurationClient.listConfigurationSettings(new SettingSelector().setLabelFilter(periodicUpdateLabel)) + .subscribe(setting -> updateConfiguration(setting)); + } + + public void addConfigurationSetting() { + ConfigurationSetting setting = configurationClient.addConfigurationSetting("new_key", "new_label", "new_value"); + } + + public void setConfigurationSetting() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + } + + public void getConfigurationSetting() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + ConfigurationSetting retrievedSetting = configurationClient.getConfigurationSetting("some_key", "some_label"); + } + + public void getConfigurationSettingConditionally() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + Response settingResponse = configurationClient.getConfigurationSettingWithResponse(setting, null, true, Context.NONE); + } + + public void updateConfigurationSetting() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + ConfigurationSetting updatedSetting = configurationClient.setConfigurationSetting("some_key", "some_label", "new_value"); + } + + public void updateConfigurationSettingConditionally() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + Response settingResponse = configurationClient.setConfigurationSettingWithResponse(setting, true, Context.NONE); + } + + public void deleteConfigurationSetting() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + ConfigurationSetting deletedSetting = configurationClient.deleteConfigurationSetting("some_key", "some_label"); + } + + public void deleteConfigurationSettingConditionally() { + ConfigurationSetting setting = configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + Response settingResponse = configurationClient.deleteConfigurationSettingWithResponse(setting, true, Context.NONE); + } + + public void listConfigurationSetting() { + String key = "some_key"; + String key2 = "new_key"; + configurationClient.setConfigurationSetting(key, "some_label", "some_value"); + configurationClient.setConfigurationSetting(key2, "new_label", "new_value"); + SettingSelector selector = new SettingSelector().setKeyFilter(key + "," + key2); + PagedIterable settings = configurationClient.listConfigurationSettings(selector); + } + + public void listRevisions() { + String key = "revisionKey"; + configurationClient.setConfigurationSetting(key, "some_label", "some_value"); + configurationClient.setConfigurationSetting(key, "new_label", "new_value"); + SettingSelector selector = new SettingSelector().setKeyFilter(key); + PagedIterable settings = configurationClient.listRevisions(selector); + } + + public void setReadOnly() { + configurationClient.setConfigurationSetting("some_key", "some_label", "some_value"); + ConfigurationSetting setting = configurationClient.setReadOnly("some_key", "some_label", true); + } + + public void clearReadOnly() { + ConfigurationSetting setting = configurationClient.setReadOnly("some_key", "some_label", false); + } + + public void customHeaders() { + // Add your headers + HttpHeaders headers = new HttpHeaders(); + headers.put("my-header1", "my-header1-value"); + headers.put("my-header2", "my-header2-value"); + headers.put("my-header3", "my-header3-value"); + // Call API by passing headers in Context. + configurationClient.addConfigurationSettingWithResponse( + new ConfigurationSetting().setKey("key").setValue("value"), + new Context(AddHeadersFromContextPolicy.AZURE_REQUEST_HTTP_HEADERS_KEY, headers)); + // Above three HttpHeader will be added in outgoing HttpRequest. + } + + private void updateConfiguration(ConfigurationSetting setting) { + // do something on the given setting. + } +} diff --git a/sdk/authorization/microsoft-azure-authentication-msi-token-provider/readme.md b/sdk/authorization/microsoft-azure-authentication-msi-token-provider/README.md similarity index 100% rename from sdk/authorization/microsoft-azure-authentication-msi-token-provider/readme.md rename to sdk/authorization/microsoft-azure-authentication-msi-token-provider/README.md diff --git a/sdk/batch/microsoft-azure-batch/changelog.md b/sdk/batch/microsoft-azure-batch/CHANGELOG.md similarity index 96% rename from sdk/batch/microsoft-azure-batch/changelog.md rename to sdk/batch/microsoft-azure-batch/CHANGELOG.md index 8ac15ad39a4c..11c7f0e0794c 100644 --- a/sdk/batch/microsoft-azure-batch/changelog.md +++ b/sdk/batch/microsoft-azure-batch/CHANGELOG.md @@ -1,5 +1,8 @@ -# Azure Batch SDK for Java release notes -## Changes in 7.0.0 +# Release History + +## 7.1.0-beta.1 (Unreleased) + +## 7.0.0 ### Features - Added ability to specify a collection of public IPs on CloudPool via the new PublicIPs property. This guarantees nodes in the Pool will have an IP from the list user provided IPs. - Added ability to mount remote file-systems on each node of a pool via the MountConfiguration property on CloudPool. @@ -9,7 +12,7 @@ ### REST API version This version of the Batch .NET client library targets version 2019-08-01.10.0 of the Azure Batch REST API. -## Changes in 6.0.0 +## 6.0.0 ### Features - **[Breaking]** Replaced PoolOperations.ListNodeAgentSkus with PoolOperations.ListSupportedImages. ListSupportedImages contains all of the same information originally available in ListNodeAgentSKUs but in a clearer format. New non-verified images are also now returned. Additional information about Capabilities and BatchSupportEndOfLife is accessible on the ImageInformation object returned by ListSupportedImages. - Now support network security rules blocking network access to a CloudPool based on the source port of the traffic. This is done via the SourcePortRanges property on NetworkSecurityGroupRule. @@ -18,12 +21,12 @@ ### REST API version This version of the Batch .NET client library targets version 2019-06-01.9.0 of the Azure Batch REST API. -## Changes in 5.0.1 +## 5.0.1 ### Features ### Fixes - Fix corrupt signing of 5.0.0 Java SDK binary -## Changes in 5.0.0 +## 5.0.0 ### Features - **[Breaking]** Removed support for the `ChangeOSVersion` API on `CloudServiceConfiguration` pools. - Removed `PoolOperations.ChangeOSVersion`. @@ -49,11 +52,11 @@ This version of the Batch .NET client library targets version 2019-06-01.9.0 of ### REST API version This version of the Batch .NET client library targets version 2018-12-01.8.0 of the Azure Batch REST API. -## Changes in 4.0.1 +## 4.0.1 ### Fixes - Fix missing signing of 4.0.0 Java SDK binary -## Changes in 4.0.0 +## 4.0.0 ### Features - Added the functionality to get which version of the Azure Batch Node Agent(https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md) is running on nodes via the NodeAgentInformation property of ComputeNode. - Added additional error handling to task add operations to prevent deadlock scenarios. @@ -64,17 +67,17 @@ This version of the Batch .NET client library targets version 2018-12-01.8.0 of ### REST API version This version of the Batch Java client library targets version 2018-08-01.7.1 of the Azure Batch REST API. See this [document](https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning#latest-version-2018-08-0171) for detail. -## Changes in 3.3.0 +## 3.3.0 ### Features - `createTasks` rethrow `RuntimeException` catched by internal threads. - `createTasks` handle `RequestSizeTooLarge` chunking errors for well behaved tasks. -## Changes in 3.2.0 +## 3.2.0 ### Features - Update comments for some classes and properties. - Added the `leavingPool` property to `NodeCounts` class. -## Changes in 3.1.0 +## 3.1.0 ### Features - Added the ability to query pool node counts by state, via the new `listPoolNodeCounts` method on `PoolOperations`. - Added the ability to upload Azure Batch node agent logs from a particular node, via the `uploadComputeNodeBatchServiceLogs` method on `ComputeNodeOperations`. @@ -84,7 +87,7 @@ This version of the Batch Java client library targets version 2018-08-01.7.1 of This version of the Batch Java client library targets version 2018-03-01.6.1 of the Azure Batch REST API. See this [document](https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning#latest-version-2018-03-0161) for detail. -## Changes in 3.0.0 +## 3.0.0 ### Features - Added the ability to get a discount on Windows VM pricing if you have on-premises licenses for the OS SKUs you are deploying, via `licenseType` on `VirtualMachineConfiguration`. - Added support for attaching empty data drives to `VirtualMachineConfiguration` based pools, via the new `dataDisks` property on `VirtualMachineConfiguration`. diff --git a/sdk/core/azure-core-amqp/CHANGELOG.md b/sdk/core/azure-core-amqp/CHANGELOG.md new file mode 100644 index 000000000000..14f7ad7a1365 --- /dev/null +++ b/sdk/core/azure-core-amqp/CHANGELOG.md @@ -0,0 +1,61 @@ +# Release History + +## 1.0.1 (2020-01-07) +- Client library name and version are no longer hard coded in connection properties. +- Update qpid-proton-j-extensions dependency +- Shorten tracing span names + +## 1.0.0-beta.8 (12-03-2019) +- Changed preview to beta. +- Fixes authorization when using client credentials. +- Changed FullyQualifiedDomainName -> FullyQualifiedNamespace. +- Renamed `BatchOptions` -> `CreateBatchOptions` and added `getRetryMode`. +- Renamed `ProxyConfiguration` -> `ProxyOption`s. +- Removed cloneable from retry policies. +- Renamed `RetryOptions`, `RetryPolicy` -> `AmqpRetryOptions`, `AmqpRetryPolicy`. +- Updated `RetryMode` -> `AmqpRetryMode`. +- Updated CBS -> ClaimsBasedSecurityNode. +- Removed final from RetryPolicy. +- Updated Hostname -> FullyQualifiedNamespace. +- `AmqpConnection` implements AutoCloseable. Added `getEndpointStates` API. +- `AmqpConnection`/`Link`/`Session` implements AutoCloseable. Added `getEndpointStates` API. +- `CBSNode` implements AutoCloseable. +- Deleted EndpointStateNotifier. Added ShutdownSignals to Connection. +- Deleted EndpointStateNotifierBase. +- Updated parameter name for MessageConstant.fromValue. +- Moved AmqpExceptionHandler into implementation class. +- Updated CBS -> Cbs. +- Added `AmqpEndpointStateUtil`. +- Closed ReactorReceiver on errors or closures in link. + +## 1.0.0-preview.7 (2019-11-04) + +## 1.0.0-preview.6 (2019-10-10) +- Added more error messages for checking null. + +## 1.0.0-preview.5 (2019-10-07) +- Getters and setters were updated to use Java Bean notation. +- Added `MessageSerializer` to azure-core-amqp. +- Moved Reactor handlers into azure-core-amqp. +- Moved implementation specific classes to azure-core-amqp. +- Moved ReactorDispatcher, AmqpErrorCode to azure-core-amqp. +- Renamed `getIdentifier` to `getId`. +- Renamed `getHost` to `getHostName`. +- Cleanup and introduced OpenCensus Tracing plugin. +- Added `PROTON_IO` in ErrorCondition. +- Added `ProxyConfiguration` for API `createConnectionHandler`. + +## 1.0.0-preview.4 (2019-09-09) +- Support tracing for azure-core-amqp. + +## 1.0.0-preview.3 (2019-08-05) +- Retry implements Cloneable. +- Rename `Retry` to `RetryPolicy`. +- `RetryOptions` implements Cloneable. + +## 1.0.0-preview.2 (2019-07-02) + +## 1.0.0-preview.1 (2019-06-28) +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-amqp_1.0.0-preview.1/core/azure-core-amqp/README.md) + diff --git a/sdk/core/azure-core-amqp/README.md b/sdk/core/azure-core-amqp/README.md index cdb69bc11a9b..76ebaeac91bc 100644 --- a/sdk/core/azure-core-amqp/README.md +++ b/sdk/core/azure-core-amqp/README.md @@ -16,7 +16,7 @@ own AMQP client library that abstracts from the underlying transport library's i com.azure azure-core-amqp - 1.0.0-preview.7 + 1.0.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index 42515a95cbc6..eac637c3f540 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -13,7 +13,7 @@ com.azure azure-core-amqp - 1.0.0-beta.9 + 1.0.1 jar Microsoft Azure Java Core AMQP Library @@ -57,7 +57,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 com.microsoft.azure diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClientConstants.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClientConstants.java index b49ac3bb93ca..cfce200c7362 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClientConstants.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClientConstants.java @@ -5,10 +5,6 @@ public final class ClientConstants { public static final String NOT_APPLICABLE = "n/a"; - public static final String PRODUCT_NAME = "azsdk-java-eventhubs"; - // {x-version-update-start;com.azure:azure-messaging-eventhubs;current} - public static final String CURRENT_JAVA_CLIENT_VERSION = "5.0.0-beta.7"; - // {x-version-update-end} public static final String PLATFORM_INFO = getOSInformation(); public static final String FRAMEWORK_INFO = getFrameworkInfo(); @@ -17,8 +13,8 @@ public final class ClientConstants { * $/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java * TODO (conniey): Extract logic from UserAgentPolicy into something we can use here. */ - public static final String USER_AGENT = String.format("%s/%s %s;%s", - PRODUCT_NAME, CURRENT_JAVA_CLIENT_VERSION, System.getProperty("java.version"), PLATFORM_INFO); + public static final String USER_AGENT_TEMPLATE = + "%s/%s " + System.getProperty("java.version") + ";" + PLATFORM_INFO; /** * The default maximum allowable size, in bytes, for a batch to be sent. diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java index 6a6393482a9d..9e895e62ebe8 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java @@ -72,10 +72,13 @@ public class ReactorConnection implements AmqpConnection { * @param reactorProvider Provides proton-j Reactor instances. * @param handlerProvider Provides {@link BaseHandler} to listen to proton-j reactor events. * @param tokenManagerProvider Provides the appropriate token manager to authorize with CBS node. + * @param messageSerializer Serializer to translate objects to and from proton-j {@link Message messages}. + * @param product The name of the product this connection is created for. + * @param clientVersion The version of the client library creating the connection. */ public ReactorConnection(String connectionId, ConnectionOptions connectionOptions, ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, TokenManagerProvider tokenManagerProvider, - MessageSerializer messageSerializer) { + MessageSerializer messageSerializer, String product, String clientVersion) { this.connectionOptions = connectionOptions; this.reactorProvider = reactorProvider; @@ -86,7 +89,7 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption this.messageSerializer = messageSerializer; this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.getFullyQualifiedNamespace(), connectionOptions.getTransportType(), - connectionOptions.getProxyOptions()); + connectionOptions.getProxyOptions(), product, clientVersion); this.retryPolicy = RetryUtil.getRetryPolicy(connectionOptions.getRetry()); this.connectionMono = Mono.fromCallable(this::getOrCreateConnection) diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorHandlerProvider.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorHandlerProvider.java index 1ebce066d2dd..408d3f40de94 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorHandlerProvider.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorHandlerProvider.java @@ -40,22 +40,26 @@ public ReactorHandlerProvider(ReactorProvider provider) { * @param connectionId Identifier associated with this connection. * @param hostname Host for the connection handler. * @param transportType Transport type used for the connection. + * @param proxyOptions The options to use for proxy. + * @param product The name of the product this connection handler is created for. + * @param clientVersion The version of the client library creating the connection handler. * @return A new {@link ConnectionHandler}. */ public ConnectionHandler createConnectionHandler(String connectionId, String hostname, - AmqpTransportType transportType, ProxyOptions proxyOptions) { + AmqpTransportType transportType, ProxyOptions proxyOptions, String product, String clientVersion) { switch (transportType) { case AMQP: - return new ConnectionHandler(connectionId, hostname); + return new ConnectionHandler(connectionId, hostname, product, clientVersion); case AMQP_WEB_SOCKETS: if (proxyOptions != null && proxyOptions.isProxyAddressConfigured()) { - return new WebSocketsProxyConnectionHandler(connectionId, hostname, proxyOptions); + return new WebSocketsProxyConnectionHandler(connectionId, hostname, proxyOptions, product, + clientVersion); } else if (WebSocketsProxyConnectionHandler.shouldUseProxy(hostname)) { logger.info("System default proxy configured for hostname '{}'. Using proxy.", hostname); return new WebSocketsProxyConnectionHandler(connectionId, hostname, - ProxyOptions.SYSTEM_DEFAULTS); + ProxyOptions.SYSTEM_DEFAULTS, product, clientVersion); } else { - return new WebSocketsConnectionHandler(connectionId, hostname); + return new WebSocketsConnectionHandler(connectionId, hostname, product, clientVersion); } default: throw logger.logExceptionAsWarning(new IllegalArgumentException(String.format(Locale.US, diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java index 1a24abcecc0f..4ee59700008f 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java @@ -36,41 +36,31 @@ public class ConnectionHandler extends Handler { static final int MAX_FRAME_SIZE = 65536; private final Map connectionProperties; - protected final ClientLogger logger; + private final ClientLogger logger = new ClientLogger(ConnectionHandler.class); /** * Creates a handler that handles proton-j's connection events. * * @param connectionId Identifier for this connection. * @param hostname Hostname of the AMQP message broker to create a connection to. + * @param product The name of the product this connection handler is created for. + * @param clientVersion The version of the client library creating the connection handler. */ - public ConnectionHandler(final String connectionId, final String hostname) { - this(connectionId, hostname, new ClientLogger(ConnectionHandler.class)); - } - - /** - * Creates a handler that handles proton-j's connection events. - * - * @param connectionId Identifier for this connection. - * @param hostname Hostname to use for socket creation. If there is a proxy configured, this could be a proxy's - * IP address. - * @param logger The service logger to use. - */ - protected ConnectionHandler(final String connectionId, final String hostname, final ClientLogger logger) { + public ConnectionHandler(final String connectionId, final String hostname, String product, String clientVersion) { super(connectionId, hostname); add(new Handshaker()); - this.logger = logger; this.connectionProperties = new HashMap<>(); - this.connectionProperties.put(PRODUCT.toString(), ClientConstants.PRODUCT_NAME); - this.connectionProperties.put(VERSION.toString(), ClientConstants.CURRENT_JAVA_CLIENT_VERSION); + this.connectionProperties.put(PRODUCT.toString(), product); + this.connectionProperties.put(VERSION.toString(), clientVersion); this.connectionProperties.put(PLATFORM.toString(), ClientConstants.PLATFORM_INFO); this.connectionProperties.put(FRAMEWORK.toString(), ClientConstants.FRAMEWORK_INFO); + String userAgent = String.format(ClientConstants.USER_AGENT_TEMPLATE, product, clientVersion); - final String userAgent = ClientConstants.USER_AGENT.length() <= MAX_USER_AGENT_LENGTH - ? ClientConstants.USER_AGENT - : ClientConstants.USER_AGENT.substring(0, MAX_USER_AGENT_LENGTH); + userAgent = userAgent.length() <= MAX_USER_AGENT_LENGTH + ? userAgent + : userAgent.substring(0, MAX_USER_AGENT_LENGTH); this.connectionProperties.put(USER_AGENT.toString(), userAgent); } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandler.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandler.java index a2bbef6b297a..965d37862891 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandler.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandler.java @@ -20,15 +20,19 @@ public class WebSocketsConnectionHandler extends ConnectionHandler { private static final String SOCKET_PATH = "/$servicebus/websocket"; private static final String PROTOCOL = "AMQPWSB10"; + private final ClientLogger logger = new ClientLogger(WebSocketsConnectionHandler.class); /** * Creates a handler that handles proton-j's connection events using web sockets. * * @param connectionId Identifier for this connection. * @param hostname Hostname to use for socket creation. + * @param product The name of the product this connection handler is created for. + * @param clientVersion The version of the client library creating the connection handler. */ - public WebSocketsConnectionHandler(final String connectionId, final String hostname) { - super(connectionId, hostname, new ClientLogger(WebSocketsConnectionHandler.class)); + public WebSocketsConnectionHandler(final String connectionId, final String hostname, final String product, + final String clientVersion) { + super(connectionId, hostname, product, clientVersion); } @Override diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandler.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandler.java index 40f37c390138..f649e4413e1e 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandler.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandler.java @@ -48,11 +48,14 @@ public class WebSocketsProxyConnectionHandler extends WebSocketsConnectionHandle * @param connectionId Identifier for this connection. * @param amqpHostname Hostname of the AMQP message broker. The hostname of the proxy is exposed in {@link * #getHostname()}. + * @param proxyOptions The options to use for proxy. + * @param product The name of the product this connection handler is created for. + * @param clientVersion The version of the client library creating the connection handler. * @throws NullPointerException if {@code amqpHostname} or {@code proxyConfiguration} is null. */ public WebSocketsProxyConnectionHandler(String connectionId, String amqpHostname, - ProxyOptions proxyOptions) { - super(connectionId, amqpHostname); + ProxyOptions proxyOptions, String product, String clientVersion) { + super(connectionId, amqpHostname, product, clientVersion); this.amqpHostname = Objects.requireNonNull(amqpHostname, "'amqpHostname' cannot be null."); this.proxyOptions = Objects.requireNonNull(proxyOptions, "'proxyConfiguration' cannot be null."); this.remoteHost = amqpHostname + ":" + HTTPS_PORT; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/MockReactorHandlerProvider.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/MockReactorHandlerProvider.java index 5bf0eb3e6b48..a496c3603b30 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/MockReactorHandlerProvider.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/MockReactorHandlerProvider.java @@ -33,8 +33,9 @@ public SessionHandler createSessionHandler(String connectionId, String hostname, } @Override - public ConnectionHandler createConnectionHandler(String connectionId, String hostname, AmqpTransportType transportType, - ProxyOptions configuration) { + public ConnectionHandler createConnectionHandler(String connectionId, String hostname, + AmqpTransportType transportType, ProxyOptions configuration, String product, String clientVersion) { + return connectionHandler; } diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java index 318ea204fbe1..c7920087df3d 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java @@ -53,6 +53,8 @@ public class ReactorConnectionTest { private static final ConnectionStringProperties CREDENTIAL_INFO = new ConnectionStringProperties("Endpoint=sb://test-event-hub.servicebus.windows.net/;SharedAccessKeyName=dummySharedKeyName;SharedAccessKey=dummySharedKeyValue;EntityPath=eventhub1;"); private static final String HOSTNAME = CREDENTIAL_INFO.getEndpoint().getHost(); private static final Scheduler SCHEDULER = Schedulers.elastic(); + private static final String PRODUCT = "test"; + private static final String CLIENT_VERSION = "1.0.0-test"; private ReactorConnection connection; private SessionHandler sessionHandler; @@ -83,7 +85,7 @@ public void setup() throws IOException { when(reactor.selectable()).thenReturn(selectable); - connectionHandler = new ConnectionHandler(CONNECTION_ID, HOSTNAME); + connectionHandler = new ConnectionHandler(CONNECTION_ID, HOSTNAME, PRODUCT, CLIENT_VERSION); final ReactorDispatcher reactorDispatcher = new ReactorDispatcher(reactor); when(reactorProvider.getReactor()).thenReturn(reactor); @@ -99,7 +101,7 @@ public void setup() throws IOException { CREDENTIAL_INFO.getEntityPath(), tokenProvider, CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, AmqpTransportType.AMQP, retryOptions, ProxyOptions.SYSTEM_DEFAULTS, SCHEDULER); connection = new ReactorConnection(CONNECTION_ID, connectionOptions, reactorProvider, reactorHandlerProvider, - tokenManager, messageSerializer); + tokenManager, messageSerializer, PRODUCT, CLIENT_VERSION); } @AfterEach @@ -274,7 +276,7 @@ public void createCBSNode() { @Test public void createCBSNodeTimeoutException() { // Arrange - final ConnectionHandler handler = new ConnectionHandler(CONNECTION_ID, HOSTNAME); + final ConnectionHandler handler = new ConnectionHandler(CONNECTION_ID, HOSTNAME, PRODUCT, CLIENT_VERSION); final ReactorHandlerProvider provider = new MockReactorHandlerProvider(reactorProvider, handler, sessionHandler, null, null); @@ -290,7 +292,7 @@ public void createCBSNodeTimeoutException() { // Act and Assert try (ReactorConnection connectionBad = new ReactorConnection(CONNECTION_ID, parameters, reactorProvider, - provider, tokenManager, messageSerializer)) { + provider, tokenManager, messageSerializer, PRODUCT, CLIENT_VERSION)) { StepVerifier.create(connectionBad.getClaimsBasedSecurityNode()) .verifyError(TimeoutException.class); } diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java index 71ec9f417833..d02798a0e3e6 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java @@ -42,6 +42,8 @@ public class ReactorHandlerProviderTest { private static final Proxy PROXY = new Proxy(Proxy.Type.HTTP, PROXY_ADDRESS); private static final String USERNAME = "test-user"; private static final String PASSWORD = "test-password"; + private static final String PRODUCT = "test"; + private static final String CLIENT_VERSION = "1.0.0-test"; @Mock private Reactor reactor; @@ -84,7 +86,8 @@ public void teardown() { @Test public void getsConnectionHandlerAMQP() { // Act - final ConnectionHandler handler = provider.createConnectionHandler(CONNECTION_ID, HOSTNAME, AmqpTransportType.AMQP, null); + final ConnectionHandler handler = provider.createConnectionHandler(CONNECTION_ID, HOSTNAME, + AmqpTransportType.AMQP, null, PRODUCT, CLIENT_VERSION); // Assert Assertions.assertNotNull(handler); @@ -99,7 +102,7 @@ public void getsConnectionHandlerAMQP() { public void getsConnectionHandlerWebSockets(ProxyOptions configuration) { // Act final ConnectionHandler handler = provider.createConnectionHandler(CONNECTION_ID, HOSTNAME, - AmqpTransportType.AMQP_WEB_SOCKETS, configuration); + AmqpTransportType.AMQP_WEB_SOCKETS, configuration, PRODUCT, CLIENT_VERSION); // Assert Assertions.assertNotNull(handler); @@ -120,7 +123,7 @@ public void getsConnectionHandlerProxy() { // Act final ConnectionHandler handler = provider.createConnectionHandler(CONNECTION_ID, hostname, - AmqpTransportType.AMQP_WEB_SOCKETS, configuration); + AmqpTransportType.AMQP_WEB_SOCKETS, configuration, PRODUCT, CLIENT_VERSION); // Assert Assertions.assertNotNull(handler); @@ -144,7 +147,7 @@ public void noProxySelected(ProxyOptions configuration) { // Act final ConnectionHandler handler = provider.createConnectionHandler(CONNECTION_ID, hostname, - AmqpTransportType.AMQP_WEB_SOCKETS, configuration); + AmqpTransportType.AMQP_WEB_SOCKETS, configuration, PRODUCT, CLIENT_VERSION); // Act and Assert Assertions.assertEquals(PROXY_ADDRESS.getHostName(), handler.getHostname()); diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java index 8313917799ef..a23b94a85488 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java @@ -26,9 +26,7 @@ import static com.azure.core.amqp.implementation.handler.ConnectionHandler.FRAMEWORK; import static com.azure.core.amqp.implementation.handler.ConnectionHandler.MAX_FRAME_SIZE; import static com.azure.core.amqp.implementation.handler.ConnectionHandler.PLATFORM; -import static com.azure.core.amqp.implementation.handler.ConnectionHandler.PRODUCT; import static com.azure.core.amqp.implementation.handler.ConnectionHandler.USER_AGENT; -import static com.azure.core.amqp.implementation.handler.ConnectionHandler.VERSION; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -39,6 +37,8 @@ public class ConnectionHandlerTest { private static final String CONNECTION_ID = "some-random-id"; private static final String HOSTNAME = "hostname-random"; private ConnectionHandler handler; + private static final String PRODUCT = "test"; + private static final String CLIENT_VERSION = "1.0.0-test"; @Captor private ArgumentCaptor> argumentCaptor; @@ -46,7 +46,7 @@ public class ConnectionHandlerTest { @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); - handler = new ConnectionHandler(CONNECTION_ID, HOSTNAME); + handler = new ConnectionHandler(CONNECTION_ID, HOSTNAME, PRODUCT, CLIENT_VERSION); } @AfterEach @@ -59,8 +59,6 @@ public void teardown() { public void createHandler() { // Arrange final Map expected = new HashMap<>(); - expected.put(PRODUCT.toString(), ClientConstants.PRODUCT_NAME); - expected.put(VERSION.toString(), ClientConstants.CURRENT_JAVA_CLIENT_VERSION); expected.put(PLATFORM.toString(), ClientConstants.PLATFORM_INFO); expected.put(FRAMEWORK.toString(), ClientConstants.FRAMEWORK_INFO); diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java index 519b5cb57a19..e53151d18a1b 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java @@ -24,8 +24,6 @@ import static com.azure.core.amqp.implementation.handler.ConnectionHandler.FRAMEWORK; import static com.azure.core.amqp.implementation.handler.ConnectionHandler.PLATFORM; -import static com.azure.core.amqp.implementation.handler.ConnectionHandler.PRODUCT; -import static com.azure.core.amqp.implementation.handler.ConnectionHandler.VERSION; import static com.azure.core.amqp.implementation.handler.WebSocketsConnectionHandler.HTTPS_PORT; import static com.azure.core.amqp.implementation.handler.WebSocketsConnectionHandler.MAX_FRAME_SIZE; import static org.mockito.ArgumentMatchers.any; @@ -39,13 +37,16 @@ public class WebSocketsConnectionHandlerTest { private static final String HOSTNAME = "hostname-random"; private WebSocketsConnectionHandler handler; + private static final String PRODUCT = "test"; + private static final String CLIENT_VERSION = "1.0.0-test"; + @Captor ArgumentCaptor> argumentCaptor; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); - handler = new WebSocketsConnectionHandler(CONNECTION_ID, HOSTNAME); + handler = new WebSocketsConnectionHandler(CONNECTION_ID, HOSTNAME, PRODUCT, CLIENT_VERSION); } @AfterEach @@ -58,8 +59,6 @@ public void teardown() { public void createHandler() { // Arrange final Map expected = new HashMap<>(); - expected.put(PRODUCT.toString(), ClientConstants.PRODUCT_NAME); - expected.put(VERSION.toString(), ClientConstants.CURRENT_JAVA_CLIENT_VERSION); expected.put(PLATFORM.toString(), ClientConstants.PLATFORM_INFO); expected.put(FRAMEWORK.toString(), ClientConstants.FRAMEWORK_INFO); diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java index 6544f9a3aa73..23a4fd102b85 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java @@ -34,6 +34,8 @@ public class WebSocketsProxyConnectionHandlerTest { private static final String PASSWORD = "test-password"; private static final ProxyOptions PROXY_CONFIGURATION = new ProxyOptions(ProxyAuthenticationType.DIGEST, PROXY, USERNAME, PASSWORD); + private static final String PRODUCT = "test"; + private static final String CLIENT_VERSION = "1.0.0-test"; private ProxySelector originalProxySelector; private ProxySelector proxySelector; @@ -56,12 +58,14 @@ public void teardown() { @Test public void nullProxyConfiguration() { - assertThrows(NullPointerException.class, () -> new WebSocketsProxyConnectionHandler(CONNECTION_ID, HOSTNAME, null)); + assertThrows(NullPointerException.class, () -> new WebSocketsProxyConnectionHandler(CONNECTION_ID, HOSTNAME, + null, PRODUCT, CLIENT_VERSION)); } @Test public void nullHostname() { - assertThrows(NullPointerException.class, () -> new WebSocketsProxyConnectionHandler(CONNECTION_ID, null, PROXY_CONFIGURATION)); + assertThrows(NullPointerException.class, () -> new WebSocketsProxyConnectionHandler(CONNECTION_ID, null, + PROXY_CONFIGURATION, PRODUCT, CLIENT_VERSION)); } /** @@ -74,7 +78,7 @@ public void noProxySelected() { .thenReturn(Collections.singletonList(PROXY)); final WebSocketsProxyConnectionHandler handler = new WebSocketsProxyConnectionHandler(CONNECTION_ID, HOSTNAME, - PROXY_CONFIGURATION); + PROXY_CONFIGURATION, PRODUCT, CLIENT_VERSION); // Act and Assert Assertions.assertEquals(PROXY_ADDRESS.getHostName(), handler.getHostname()); @@ -91,7 +95,7 @@ public void systemProxyConfigurationSelected() { .thenReturn(Collections.singletonList(PROXY)); final WebSocketsProxyConnectionHandler handler = new WebSocketsProxyConnectionHandler(CONNECTION_ID, HOSTNAME, - ProxyOptions.SYSTEM_DEFAULTS); + ProxyOptions.SYSTEM_DEFAULTS, PRODUCT, CLIENT_VERSION); // Act and Assert Assertions.assertEquals(PROXY_ADDRESS.getHostName(), handler.getHostname()); @@ -114,7 +118,8 @@ public void proxyConfigurationSelected() { when(proxySelector.select(any())).thenReturn(Collections.singletonList(PROXY)); - final WebSocketsProxyConnectionHandler handler = new WebSocketsProxyConnectionHandler(CONNECTION_ID, host, configuration); + final WebSocketsProxyConnectionHandler handler = new WebSocketsProxyConnectionHandler(CONNECTION_ID, host, + configuration, PRODUCT, CLIENT_VERSION); // Act and Assert Assertions.assertEquals(address.getHostName(), handler.getHostname()); diff --git a/sdk/core/azure-core-http-netty/CHANGELOG.md b/sdk/core/azure-core-http-netty/CHANGELOG.md new file mode 100644 index 000000000000..7113a024ad22 --- /dev/null +++ b/sdk/core/azure-core-http-netty/CHANGELOG.md @@ -0,0 +1,14 @@ +# Release History + +## 1.2.0 (2020-01-07) +- Upgrade netty dependencies to latest version + +## Version 1.1.0 (2019-11-26) +- Switch to JUnit version 5. + +## Version 1.0.0 (2019-10-29) +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-http-netty_1.0.0/sdk/core/azure-core-http-netty/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-core-http-netty_1.0.0/sdk/core/azure-core-http-netty/src/samples/java/com/azure/core/http/netty) + diff --git a/sdk/core/azure-core-http-netty/README.md b/sdk/core/azure-core-http-netty/README.md index 871a6e279639..ab730e281d3e 100644 --- a/sdk/core/azure-core-http-netty/README.md +++ b/sdk/core/azure-core-http-netty/README.md @@ -15,7 +15,7 @@ Azure Core Netty HTTP client is a plugin for the azure-core HTTP client API. com.azure azure-core-http-netty - 1.0.0 + 1.2.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-http-netty/pom.xml b/sdk/core/azure-core-http-netty/pom.xml index c87a49b0ef01..bb168dfdc1df 100644 --- a/sdk/core/azure-core-http-netty/pom.xml +++ b/sdk/core/azure-core-http-netty/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-http-netty jar - 1.2.0-beta.1 + 1.2.0 Microsoft Azure Netty HTTP Client Library This package contains the Netty HTTP client plugin for azure-core. @@ -58,7 +58,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 @@ -109,14 +109,14 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 test-jar test com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0 test diff --git a/sdk/core/azure-core-http-okhttp/CHANGELOG.md b/sdk/core/azure-core-http-okhttp/CHANGELOG.md new file mode 100644 index 000000000000..fde4a1cfa712 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/CHANGELOG.md @@ -0,0 +1,12 @@ +# Release History + +## 1.1.0 (2020-01-07) +- Updated version of dependent libraries. + +## Version 1.0.0 (2019-10-29) +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-core_1.0.0/sdk/core/azure-core-http-okhttp/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-core_1.0.0/sdk/core/azure-core-http-okhttp/src/samples/java/com/azure/core/http/okhttp) + +- Initial release. Please see the README and wiki for information on the new design. diff --git a/sdk/core/azure-core-http-okhttp/README.md b/sdk/core/azure-core-http-okhttp/README.md index 7804f0c333e6..87f0ec97e9fe 100644 --- a/sdk/core/azure-core-http-okhttp/README.md +++ b/sdk/core/azure-core-http-okhttp/README.md @@ -15,7 +15,7 @@ Azure Core OkHttp HTTP client is a plugin for the azure-core HTTP client API. com.azure azure-core-http-okhttp - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-http-okhttp/pom.xml b/sdk/core/azure-core-http-okhttp/pom.xml index 84eaa3602920..acb98d3661f9 100644 --- a/sdk/core/azure-core-http-okhttp/pom.xml +++ b/sdk/core/azure-core-http-okhttp/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-http-okhttp jar - 1.1.0-beta.1 + 1.1.0 Microsoft Azure OkHttp HTTP Client Library This package contains the OkHttp HTTP client plugin for azure-core. @@ -59,7 +59,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 @@ -72,14 +72,14 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 test-jar test com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0 test diff --git a/sdk/core/azure-core-management/CHANGELOG.md b/sdk/core/azure-core-management/CHANGELOG.md new file mode 100644 index 000000000000..2bd5f4012be3 --- /dev/null +++ b/sdk/core/azure-core-management/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-preview.4 (2019-09-09) + +## Version 1.0.0-preview.3 (2019-08-05) + +## Version 1.0.0-preview.1 (2019-06-28) +- Initial release. This package contains Microsoft Azure SDK for Template. diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index c71d8805b64f..7031bc211bad 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -57,7 +57,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 @@ -76,13 +76,13 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0 test com.azure azure-core-http-netty - 1.2.0-beta.1 + 1.2.0 test diff --git a/sdk/core/azure-core-test/CHANGELOG.md b/sdk/core/azure-core-test/CHANGELOG.md new file mode 100644 index 000000000000..efda3f873626 --- /dev/null +++ b/sdk/core/azure-core-test/CHANGELOG.md @@ -0,0 +1,18 @@ +# Release History + +## 1.1.0 (2020-01-07) + +## 1.1.0-beta.2 (2019-12-18) +- Quick release to have client library depends on the right version of azure-core and azure-core-test changes. + +## Version 1.1.0-beta.1 (2019-12-17) +- Added log message if playback json file is missing. +- Fixed bug which record failed for newly added tests. +- Switch to JUnit version 5. +- Allowed to record body when content type is not set. + +## Version 1.0.0 (2019-10-29) +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-test_1.0.0/sdk/core/azure-core-test/README.md) + +- Initial release. Please see the README and wiki for information on the new design. diff --git a/sdk/core/azure-core-test/README.md b/sdk/core/azure-core-test/README.md index 37a7a50251f6..e1152a091f1d 100644 --- a/sdk/core/azure-core-test/README.md +++ b/sdk/core/azure-core-test/README.md @@ -18,7 +18,7 @@ To use this package, add the following to your _pom.xml_. com.azure azure-core-test - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index 663eb5716991..e173f7bf7453 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -13,7 +13,7 @@ com.azure azure-core-test jar - 1.1.0-beta.1 + 1.1.0 Microsoft Azure Java Core Test Library This package contains core test types for Azure Java clients. @@ -38,7 +38,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 diff --git a/sdk/core/azure-core-tracing-opencensus/CHANGELOG.md b/sdk/core/azure-core-tracing-opencensus/CHANGELOG.md index f37153af1e75..e94dda12e95c 100644 --- a/sdk/core/azure-core-tracing-opencensus/CHANGELOG.md +++ b/sdk/core/azure-core-tracing-opencensus/CHANGELOG.md @@ -1,5 +1,10 @@ # Release History -## Version 1.0.0-beta.5 (2019-11-26) + +## 1.0.0-beta.6 (2020-01-07) +- Shorten tracing span names +- Add eventhub properties to processing spans + +## 1.0.0-beta.5 (2019-11-26) For details on the Azure SDK for Java (December 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview6-java). - Extended support for 0.24.0 opencensus-api package version. - Added tracing instrumentation for Batch send operation in Eventhubs. @@ -9,8 +14,7 @@ This package's and [samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opencensus_1.0.0-beta.5/sdk/core/azure-core-tracing-opencensus/src/samples). -## Version 1.0.0-preview.4 (2019-10-31) - +## 1.0.0-preview.4 (2019-10-31) For details on the Azure SDK for Java (November 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview5-java). Version 1.0.0-preview.4 added tracing support for AMQP and HTTP client libraries across different languages and platforms as possible. - Fixed Service loader provider configuration file to correctly trace HTTP requests. @@ -22,7 +26,7 @@ See this package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-tracing-opencensus/README.md) and [samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/core/azure-core-tracing-opencensus/src/samples) demonstrate the new API. -## Version 1.0.0-preview.3 (2019-10-07) +## 1.0.0-preview.3 (2019-10-07) For details on the Azure SDK for Java (October 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview4-java). Version 1.0.0-preview.3 added tracing support for AMQP client libraries across different languages and platforms as possible. @@ -30,12 +34,12 @@ See this package's [documentation](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/tracing/azure-core-tracing-opencensus/README.md) and [samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/tracing/azure-core-tracing-opencensus/src/samples/java/com/azure/core/tracing/opencensus) demonstrate the new API. -## Version 1.0.0-preview.2 (2019-09-09) +## 1.0.0-preview.2 (2019-09-09) For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). Version 1.0.0-preview.2 added tracing support to all of the HTTP based Azure SDK Java libraries. -## Version 1.0.0-preview.1 (2019-08-06) +## 1.0.0-preview.1 (2019-08-06) Version 1.0.0-preview.1 is the first preview of our efforts to provide low level interfaces and helper methods to support tracing for Java client libraries. This library includes [OpenTelemetry](https://opentelemetry.io/) implementation of the interface, For more information about this, and preview releases of other Azure SDK libraries, please visit https://aka.ms/azure-sdk-preview2-java. diff --git a/sdk/core/azure-core-tracing-opencensus/README.md b/sdk/core/azure-core-tracing-opencensus/README.md index 00a7c834c67e..f0f05a179123 100644 --- a/sdk/core/azure-core-tracing-opencensus/README.md +++ b/sdk/core/azure-core-tracing-opencensus/README.md @@ -19,7 +19,7 @@ documentation][api_documentation] | [Samples][samples] com.azure azure-core-tracing-opencensus - 1.0.0-beta.5 + 1.0.0-beta.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opencensus/pom.xml b/sdk/core/azure-core-tracing-opencensus/pom.xml index 2312a96f885e..6586b4d148ee 100644 --- a/sdk/core/azure-core-tracing-opencensus/pom.xml +++ b/sdk/core/azure-core-tracing-opencensus/pom.xml @@ -35,7 +35,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 io.opencensus diff --git a/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncListKeyVaultSecrets.md b/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncListKeyVaultSecrets.md index 1e29612b229d..8d3fee19e4cb 100644 --- a/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncListKeyVaultSecrets.md +++ b/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncListKeyVaultSecrets.md @@ -12,7 +12,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-security-keyvault-secrets - 4.0.1 + 4.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -22,7 +22,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-core-tracing-opencensus - 1.0.0-beta.5 + 1.0.0-beta.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncQueueClientEnqueueMessages.md b/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncQueueClientEnqueueMessages.md index 27e2066b6f39..6036ba56a8c9 100644 --- a/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncQueueClientEnqueueMessages.md +++ b/sdk/core/azure-core-tracing-opencensus/src/samples/AsyncQueueClientEnqueueMessages.md @@ -14,7 +14,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-storage-queue - 12.1.0 + 12.2.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -24,7 +24,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-core-tracing-opencensus - 1.0.0-beta.5 + 1.0.0-beta.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opencensus/src/samples/ListeKeyVaultSecrets.md b/sdk/core/azure-core-tracing-opencensus/src/samples/ListeKeyVaultSecrets.md index 4ed8864983f8..d9cd3b2c1d69 100644 --- a/sdk/core/azure-core-tracing-opencensus/src/samples/ListeKeyVaultSecrets.md +++ b/sdk/core/azure-core-tracing-opencensus/src/samples/ListeKeyVaultSecrets.md @@ -13,7 +13,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-security-keyvault-secrets - 4.0.1 + 4.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -23,7 +23,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-core-tracing-opencensus - 1.0.0-beta.5 + 1.0.0-beta.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opencensus/src/samples/PublishEvents.md b/sdk/core/azure-core-tracing-opencensus/src/samples/PublishEvents.md index 29674153f9b8..0aa1922558a4 100644 --- a/sdk/core/azure-core-tracing-opencensus/src/samples/PublishEvents.md +++ b/sdk/core/azure-core-tracing-opencensus/src/samples/PublishEvents.md @@ -14,7 +14,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-messaging-eventhubs - 5.0.0-beta.6 + 5.0.1 ``` [//]: # ({x-version-update-end}) @@ -24,7 +24,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-core-tracing-opencensus - 1.0.0-beta.5 + 1.0.0-beta.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opencensus/src/samples/QueueClientEnqueueMessages.md b/sdk/core/azure-core-tracing-opencensus/src/samples/QueueClientEnqueueMessages.md index 8ce90a2ff790..de57c3ad26cb 100644 --- a/sdk/core/azure-core-tracing-opencensus/src/samples/QueueClientEnqueueMessages.md +++ b/sdk/core/azure-core-tracing-opencensus/src/samples/QueueClientEnqueueMessages.md @@ -14,7 +14,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-storage-queue - 12.1.0 + 12.2.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -24,7 +24,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and com.azure azure-core-tracing-opencensus - 1.0.0-beta.5 + 1.0.0-beta.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md b/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md index 3fd77148407c..2d03ed4fd3af 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md +++ b/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md @@ -1,5 +1,6 @@ # Release History -## Version 1.0.0-beta.2 (2020-01-03) + +## 1.0.0-beta.2 (2020-01-07) - Add `EventHubs.*` properties to attributes of processing spans. - Remove `Azure` prefix from convenience layer span names. - Add links for batch send operation in Event Hubs client library. @@ -9,7 +10,7 @@ This package's and [samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opentelemetry_1.0.0-beta.2/sdk/core/azure-core-tracing-opentelemetry/src/samples). -## Version 1.0.0-beta.1 (2019-11-26) +## 1.0.0-beta.1 (2019-11-26) For details on the Azure SDK for Java (Decemeber 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview5-java). Version 1.0.0-beta.1 is the first preview of our efforts to provide low level interfaces and helper methods to support tracing for Java client libraries. diff --git a/sdk/core/azure-core-tracing-opentelemetry/README.md b/sdk/core/azure-core-tracing-opentelemetry/README.md index 772a8b26ac5a..307e72118cf0 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/README.md +++ b/sdk/core/azure-core-tracing-opentelemetry/README.md @@ -19,7 +19,7 @@ documentation][api_documentation] | [Samples][samples] com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opentelemetry/pom.xml b/sdk/core/azure-core-tracing-opentelemetry/pom.xml index b08e871d072a..6fe42e14f911 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/pom.xml +++ b/sdk/core/azure-core-tracing-opentelemetry/pom.xml @@ -40,7 +40,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 diff --git a/sdk/core/azure-core-tracing-opentelemetry/src/samples/AsyncListKeyVaultSecretsSample.md b/sdk/core/azure-core-tracing-opentelemetry/src/samples/AsyncListKeyVaultSecretsSample.md index 8363154334c7..0959b1c92424 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/src/samples/AsyncListKeyVaultSecretsSample.md +++ b/sdk/core/azure-core-tracing-opentelemetry/src/samples/AsyncListKeyVaultSecretsSample.md @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package com.azure azure-security-keyvault-secrets - 4.0.1 + 4.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opentelemetry/src/samples/CreateConfigurationSettingTracingSample.md b/sdk/core/azure-core-tracing-opentelemetry/src/samples/CreateConfigurationSettingTracingSample.md index 76df142d273d..5c87cbe73150 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/src/samples/CreateConfigurationSettingTracingSample.md +++ b/sdk/core/azure-core-tracing-opentelemetry/src/samples/CreateConfigurationSettingTracingSample.md @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package com.azure azure-data-appconfiguration - 1.0.0-beta.7 + 1.0.1 ``` [//]: # ({x-version-update-end}) @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opentelemetry/src/samples/ListKeyVaultSecretsTracingSample.md b/sdk/core/azure-core-tracing-opentelemetry/src/samples/ListKeyVaultSecretsTracingSample.md index 289faf51bc67..59a470f859f8 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/src/samples/ListKeyVaultSecretsTracingSample.md +++ b/sdk/core/azure-core-tracing-opentelemetry/src/samples/ListKeyVaultSecretsTracingSample.md @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package com.azure azure-security-keyvault-secrets - 4.0.1 + 4.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core-tracing-opentelemetry/src/samples/PublishEventsTracingSample.md b/sdk/core/azure-core-tracing-opentelemetry/src/samples/PublishEventsTracingSample.md index 6256f61fba68..e7243cc6b068 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/src/samples/PublishEventsTracingSample.md +++ b/sdk/core/azure-core-tracing-opentelemetry/src/samples/PublishEventsTracingSample.md @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** for implementation and ** com.azure azure-messaging-eventhubs - 5.0.0-beta.6 + 5.0.1 ``` [//]: # ({x-version-update-end}) @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** for implementation and ** com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 0eabe5ec324d..64686db0d1a5 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,4 +1,15 @@ -# Change Log azure-core +# Release History + +## 1.2.0 (2020-01-07) +- Ignore null headers and allow full url paths +- Add missing HTTP request methods to HttpMethod enum +- Support custom header with AddHeaderPolicy +- Support custom header name in RequestIDPolicy +- Prevent HttpLoggingPolicy Consuming Body +- Hide secret info from log info +- Ensure HTTPS is used when authenticating with tokens +- Reduce Prefetch Limit for PagedIterable and IterableStream +- Add Iterable overload for IterableStream ## Version 1.1.0 (2019-11-26) - Added support for creating reactor-netty-http client from an existing client. diff --git a/sdk/core/azure-core/README.md b/sdk/core/azure-core/README.md index 9d3e946a097a..9c022e439f99 100644 --- a/sdk/core/azure-core/README.md +++ b/sdk/core/azure-core/README.md @@ -15,7 +15,7 @@ Typically, you will not need to install or specifically depend on Azure Core, in com.azure azure-core - 1.0.0 + 1.2.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 0cae6624246b..29c7eaf4c347 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -14,7 +14,7 @@ com.azure azure-core jar - 1.2.0-beta.1 + 1.2.0 Microsoft Azure Java Core Library This package contains core types for Azure Java clients. @@ -120,12 +120,12 @@ 2.2 test - - org.slf4j - slf4j-simple - 1.7.25 - test - + + + + + + org.mockito mockito-core diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java index 50f6a5f196ad..9e0b153593ba 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java @@ -10,11 +10,11 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.implementation.LogLevel; import com.azure.core.implementation.LoggingUtil; import com.azure.core.util.CoreUtils; import com.azure.core.util.UrlBuilder; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import reactor.core.publisher.Mono; @@ -101,7 +101,8 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN * @return A Mono which will emit the string to log. */ private Mono logRequest(final ClientLogger logger, final HttpRequest request) { - int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); + int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().getLogLevel(); + if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.empty(); } @@ -181,7 +182,7 @@ private Mono logRequest(final ClientLogger logger, final HttpRequest reque * @return A Mono containing the HTTP response. */ private Mono logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { - int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); + int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().getLogLevel(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } @@ -260,7 +261,7 @@ private Mono logAndReturn(ClientLogger logger, StringBuilder logMessageBu * @return A flag indicating if logging should be skipped. */ private boolean shouldLoggingBeSkipped(int environmentLogLevel) { - return environmentLogLevel > LogLevel.INFORMATIONAL.toNumeric(); + return environmentLogLevel > LogLevel.INFORMATIONAL.getLogLevel(); } /* @@ -318,7 +319,7 @@ private String getAllowedQueryString(String queryString) { */ private void addHeadersToLogMessage(HttpHeaders headers, StringBuilder sb, int logLevel) { // Either headers shouldn't be logged or the logging level isn't set to VERBOSE, don't add headers. - if (!httpLogDetailLevel.shouldLogHeaders() || logLevel > LogLevel.VERBOSE.toNumeric()) { + if (!httpLogDetailLevel.shouldLogHeaders() || logLevel > LogLevel.VERBOSE.getLogLevel()) { return; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LogLevel.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LogLevel.java deleted file mode 100644 index 56c83b5c5909..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LogLevel.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.implementation; - -/** - * Enum which represent logging levels used in Azure SDKs. - */ -public enum LogLevel { - /** - * Indicates that log level is at verbose level. - */ - VERBOSE(1), - - /** - * Indicates that log level is at information level. - */ - INFORMATIONAL(2), - - /** - * Indicates that log level is at warning level. - */ - WARNING(3), - - /** - * Indicates that log level is at error level. - */ - ERROR(4), - - /** - * Indicates that logging is disabled. - */ - DISABLED(5); - - private final int numericValue; - - LogLevel(int numericValue) { - this.numericValue = numericValue; - } - - /** - * Converts the log level into a numeric representation used for comparisons. - * - * @return The numeric representation of the log level. - */ - public int toNumeric() { - return numericValue; - } -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LoggingUtil.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LoggingUtil.java index bfff5d531638..3f7eb257a99e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LoggingUtil.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/LoggingUtil.java @@ -4,33 +4,24 @@ package com.azure.core.implementation; import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; - -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; +import com.azure.core.util.logging.LogLevel; /** * This class contains utility methods useful for logging. */ public final class LoggingUtil { - private static final Map LOG_LEVEL_MAPPER = Arrays.stream(LogLevel.values()) - .collect(Collectors.toMap(LogLevel::toNumeric, logLevel -> logLevel)); - /** * Retrieve the environment logging level which is used to determine if and what we are allowed to log. * *

The value returned from this method should be used throughout a single logging event as it may change during * the logging operation, this will help prevent difficult to debug timing issues.

* - * @return Environment logging level if set, otherwise {@link LogLevel#DISABLED}. + * @return Environment logging level if set, otherwise {@link LogLevel#NOT_SET}. */ public static LogLevel getEnvironmentLoggingLevel() { String environmentLogLevel = Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_LOG_LEVEL); - return CoreUtils.isNullOrEmpty(environmentLogLevel) - ? LogLevel.DISABLED - : LOG_LEVEL_MAPPER.getOrDefault(Integer.parseInt(environmentLogLevel), LogLevel.DISABLED); + return LogLevel.fromString(environmentLogLevel); } // Private constructor diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java index 27868d089e66..a69f849876a3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java @@ -3,14 +3,13 @@ package com.azure.core.util.logging; -import com.azure.core.implementation.LogLevel; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Arrays; import java.util.Objects; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.helpers.NOPLogger; import static com.azure.core.implementation.LoggingUtil.getEnvironmentLoggingLevel; @@ -37,6 +36,7 @@ */ public class ClientLogger { private final Logger logger; + private final java.util.logging.Logger defaultLogger; /** * Retrieves a logger for the passed class using the {@link LoggerFactory}. @@ -54,6 +54,7 @@ public ClientLogger(Class clazz) { */ public ClientLogger(String className) { logger = LoggerFactory.getLogger(className); + defaultLogger = java.util.logging.Logger.getLogger(className); } /** @@ -132,10 +133,9 @@ public void error(String format, Object... args) { * @param args Arguments for the message, if an exception is being logged last argument is the throwable. */ private void log(LogLevel logLevel, String format, Object... args) { - LogLevel environmentLoggingLevel = getEnvironmentLoggingLevel(); - - if (canLogAtLevel(logLevel, environmentLoggingLevel)) { - performLogging(logLevel, environmentLoggingLevel, false, format, args); + LogLevel rootLogLevel = loadSystemLogLevel(); + if (canLogAtLevel(logLevel, rootLogLevel)) { + performLogging(logLevel, rootLogLevel, false, format, args); } } @@ -163,11 +163,10 @@ public RuntimeException logExceptionAsError(RuntimeException runtimeException) { private RuntimeException logException(RuntimeException runtimeException, LogLevel logLevel) { Objects.requireNonNull(runtimeException, "'runtimeException' cannot be null."); + LogLevel rootLogLevel = loadSystemLogLevel(); - LogLevel environmentLoggingLevel = getEnvironmentLoggingLevel(); - - if (canLogAtLevel(logLevel, environmentLoggingLevel)) { - performLogging(logLevel, environmentLoggingLevel, true, runtimeException.getMessage(), runtimeException); + if (canLogAtLevel(logLevel, rootLogLevel)) { + performLogging(logLevel, rootLogLevel, true, runtimeException.getMessage(), runtimeException); } return runtimeException; @@ -179,8 +178,8 @@ private RuntimeException logException(RuntimeException runtimeException, LogLeve * @param format formattable message. * @param args Arguments for the message, if an exception is being logged last argument is the throwable. */ - private void performLogging(LogLevel logLevel, LogLevel environmentLogLevel, boolean isExceptionLogging, - String format, Object... args) { + private void performLogging(LogLevel logLevel, LogLevel rootLogLevel, + boolean isExceptionLogging, String format, Object... args) { // If the logging level is less granular than verbose remove the potential throwable from the args. String throwableMessage = ""; if (doesArgsHaveThrowable(args)) { @@ -198,11 +197,55 @@ private void performLogging(LogLevel logLevel, LogLevel environmentLogLevel, boo * Environment is logging at a level higher than verbose, strip out the throwable as it would log its * stack trace which is only expected when logging at a verbose level. */ - if (environmentLogLevel.toNumeric() > LogLevel.VERBOSE.toNumeric()) { + if (rootLogLevel.getLogLevel() > LogLevel.VERBOSE.getLogLevel()) { args = removeThrowable(args); } } + boolean isFromEnv = isLogFromEnv(); + printInPlace(isFromEnv, throwableMessage, logLevel, format, args); + } + + private void printInPlace(boolean isFromEnv, String throwableMessage, LogLevel logLevel, String format, + Object... args) { + if (isFromEnv) { + printFromDefaultLogger(throwableMessage, logLevel, format, args); + } else { + printFromLogger(throwableMessage, logLevel, format, args); + } + } + + private void printFromDefaultLogger(String throwableMessage, LogLevel logLevel, String format, Object... args) { + switch (logLevel) { + case VERBOSE: + defaultLogger.log(java.util.logging.Level.FINE, format, args); + break; + case INFORMATIONAL: + defaultLogger.log(java.util.logging.Level.INFO, format, args); + break; + case WARNING: + if (!CoreUtils.isNullOrEmpty(throwableMessage)) { + format += System.lineSeparator() + throwableMessage; + } + defaultLogger.log(java.util.logging.Level.WARNING, format, args); + break; + case ERROR: + if (!CoreUtils.isNullOrEmpty(throwableMessage)) { + format += System.lineSeparator() + throwableMessage; + } + defaultLogger.log(java.util.logging.Level.SEVERE, format, args); + break; + default: + // Don't do anything, this state shouldn't be possible. + break; + } + } + + private boolean isLogFromEnv() { + return logger instanceof NOPLogger; + } + + private void printFromLogger(String throwableMessage, LogLevel logLevel, String format, Object... args) { switch (logLevel) { case VERBOSE: logger.debug(format, args); @@ -228,32 +271,44 @@ private void performLogging(LogLevel logLevel, LogLevel environmentLogLevel, boo } } - /* - * Determines if the environment and logger support logging at the given log level. + /** + * Determines if the app or environment logger support logging at the given log level. * * @param logLevel Logging level for the log message. - * @param environmentLoggingLevel Logging level the environment is set to support. * @return Flag indicating if the environment and logger are configured to support logging at the given log level. */ - private boolean canLogAtLevel(LogLevel logLevel, LogLevel environmentLoggingLevel) { - // Attempting to log at a level not supported by the environment. - if (logLevel.toNumeric() < environmentLoggingLevel.toNumeric()) { - return false; - } + public boolean canLogAtLevel(LogLevel logLevel) { + LogLevel rootLogLevel = loadSystemLogLevel(); + return canLogAtLevel(logLevel, rootLogLevel); + } - // Determine if the logger configuration supports logging at the level. - switch (logLevel) { - case VERBOSE: - return logger.isDebugEnabled(); - case INFORMATIONAL: - return logger.isInfoEnabled(); - case WARNING: - return logger.isWarnEnabled(); - case ERROR: - return logger.isErrorEnabled(); - default: - return false; + private boolean canLogAtLevel(LogLevel logLevel, LogLevel allowedLogLevel) { + // Attempting to log at a level not supported by the SLF4J configuration or env variable. + return logLevel.getLogLevel() >= allowedLogLevel.getLogLevel(); + } + + /** + * Checking the system log with the preference order of slf4j and environment variable. + * + * @return The log level. + */ + private LogLevel loadSystemLogLevel() { + if (isLogFromEnv()) { + return getEnvironmentLoggingLevel(); + } + if (logger.isDebugEnabled()) { + return LogLevel.VERBOSE; + } + if (logger.isInfoEnabled()) { + return LogLevel.INFORMATIONAL; + } + if (logger.isWarnEnabled()) { + return LogLevel.WARNING; + } + if (logger.isErrorEnabled()) { + return LogLevel.ERROR; } + return LogLevel.NOT_SET; } /* diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/LogLevel.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/LogLevel.java new file mode 100644 index 000000000000..7cd22e43900e --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/LogLevel.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util.logging; + +import java.util.HashMap; +import java.util.Locale; + +/** + * Enum which represent logging levels used in Azure SDKs. + */ +public enum LogLevel { + /** + * Indicates that log level is at verbose level. + */ + VERBOSE(1, "1", "verbose", "debug"), + + /** + * Indicates that log level is at information level. + */ + INFORMATIONAL(2, "2", "info", "information", "informational"), + + /** + * Indicates that log level is at warning level. + */ + WARNING(3, "3", "warn", "warning"), + + /** + * Indicates that log level is at error level. + */ + ERROR(4, "4", "err", "error"), + + /** + * Indicates that no log level is set. + */ + NOT_SET(5); + + private final int numericValue; + private final String[] allowedLogLevelVariables; + private static final HashMap LOG_LEVEL_STRING_MAPPER = new HashMap<>(); + + static { + for (LogLevel logLevel: LogLevel.values()) { + for (String val: logLevel.allowedLogLevelVariables) { + LOG_LEVEL_STRING_MAPPER.put(val, logLevel); + } + } + } + + LogLevel(int numericValue, String... allowedLogLevelVariables) { + this.numericValue = numericValue; + this.allowedLogLevelVariables = allowedLogLevelVariables; + } + + /** + * Converts the log level into a numeric representation used for comparisons. + * + * @return The numeric representation of the log level. + */ + public int getLogLevel() { + return numericValue; + } + + /** + * Converts the passed log level string to the corresponding {@link LogLevel}. + * + * @param logLevelVal The log level value which needs to convert + * @return The LogLevel Enum if pass in the valid string. + * The valid strings for {@link LogLevel} are: + *
    + *
  • VERBOSE: "verbose", "debug"
  • + *
  • INFO: "info", "information", "informational"
  • + *
  • WARNING: "warn", "warning"
  • + *
  • ERROR: "err", "error"
  • + *
+ * Returns NOT_SET if null is passed in. + * @throws IllegalArgumentException if the log level value is invalid. + */ + public static LogLevel fromString(String logLevelVal) { + if (logLevelVal == null) { + return LogLevel.NOT_SET; + } + String caseInsensitiveLogLevel = logLevelVal.toLowerCase(Locale.ROOT); + if (!LOG_LEVEL_STRING_MAPPER.containsKey(caseInsensitiveLogLevel)) { + throw new IllegalArgumentException("We currently do not support the log level you set. LogLevel: " + + logLevelVal); + } + return LOG_LEVEL_STRING_MAPPER.get(caseInsensitiveLogLevel); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java index acf30ddcc7cb..f92b4cfef8de 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java @@ -211,7 +211,7 @@ public interface Tracer { *

Code samples

* *

Returns a builder with the provided span name.

- * {@codesnippet com.azure.core.util.tracing.getSharedSpanBuilder#string-context} + * {@codesnippet com.azure.core.util.tracing.getSpanBuilder#string-context} * * @param spanName Name to give the span for the created builder. * @param context Additional metadata that is passed through the call stack. diff --git a/sdk/core/azure-core/src/main/java/module-info.java b/sdk/core/azure-core/src/main/java/module-info.java index 5e472555d78e..2a158e749b40 100644 --- a/sdk/core/azure-core/src/main/java/module-info.java +++ b/sdk/core/azure-core/src/main/java/module-info.java @@ -14,7 +14,7 @@ requires transitive org.reactivestreams; requires transitive org.slf4j; - + requires transitive java.logging; // public API surface area exports com.azure.core.annotation; exports com.azure.core.credential; diff --git a/sdk/core/azure-core/src/main/resources/logging.properties b/sdk/core/azure-core/src/main/resources/logging.properties new file mode 100644 index 000000000000..d3864f3a54f2 --- /dev/null +++ b/sdk/core/azure-core/src/main/resources/logging.properties @@ -0,0 +1 @@ +.level = FINE diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java index df464a9dbf01..dc4d7c8e2c63 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java @@ -15,6 +15,13 @@ import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; +import java.util.logging.StreamHandler; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -38,6 +45,7 @@ import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.fail; /** * This class contains tests for {@link HttpLoggingPolicy}. @@ -47,8 +55,9 @@ public class HttpLoggingPolicyTests { private static final Context CONTEXT = new Context("caller-method", "HttpLoggingPolicyTests"); private String originalLogLevel; - private PrintStream originalErr; private ByteArrayOutputStream logCaptureStream; + private Logger mockLogger; + private StreamHandler sh; @BeforeEach public void prepareForTest() { @@ -56,21 +65,15 @@ public void prepareForTest() { originalLogLevel = System.getProperty(Configuration.PROPERTY_AZURE_LOG_LEVEL); System.setProperty(Configuration.PROPERTY_AZURE_LOG_LEVEL, "2"); - /* - * Indicate to SLF4J to enable trace level logging for a logger named - * com.azure.core.util.logging.ClientLoggerTests. Trace is the maximum level of logging supported by the - * ClientLogger. - */ - System.setProperty("org.slf4j.simpleLogger.log.com.azure.core.util.logging.HttpLoggingPolicyTests", "trace"); - - // Override System.err as that is where SLF4J will log by default. - originalErr = System.err; + mockLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); logCaptureStream = new ByteArrayOutputStream(); - System.setErr(new PrintStream(logCaptureStream)); + sh = new StreamHandler(new PrintStream(logCaptureStream), new SimpleFormatter()); + sh.setLevel(Level.FINEST); + mockLogger.addHandler(sh); } @AfterEach - public void cleanupAfterTest() { + public void cleanupAfterTest() throws Exception { // Reset or clear the log level after the test completes. if (CoreUtils.isNullOrEmpty(originalLogLevel)) { System.clearProperty(Configuration.PROPERTY_AZURE_LOG_LEVEL); @@ -78,10 +81,8 @@ public void cleanupAfterTest() { System.setProperty(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); } - System.clearProperty("org.slf4j.simpleLogger.log.com.azure.core.util.logging.HttpLoggingPolicyTests"); - - // Reset System.err to the original PrintStream. - System.setErr(originalErr); + sh.close(); + logCaptureStream.close(); } /** @@ -91,44 +92,23 @@ public void cleanupAfterTest() { @MethodSource("redactQueryParametersSupplier") public void redactQueryParameters(String requestUrl, String expectedQueryString, Set allowedQueryParameters) { + HttpLoggingPolicy loggingPolicy = new HttpLoggingPolicy(new HttpLogOptions() + .setLogLevel(HttpLogDetailLevel.BASIC) + .setAllowedQueryParamNames(allowedQueryParameters)); + HttpRequest httpRequest = new HttpRequest(HttpMethod.POST, requestUrl); + mockLoggerForLoggingPolicyRequest(loggingPolicy, httpRequest); HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(new HttpLoggingPolicy(new HttpLogOptions() - .setLogLevel(HttpLogDetailLevel.BASIC) - .setAllowedQueryParamNames(allowedQueryParameters))) + .policies(loggingPolicy) .httpClient(new NoOpHttpClient()) .build(); - StepVerifier.create(pipeline.send(new HttpRequest(HttpMethod.POST, requestUrl), CONTEXT)) + StepVerifier.create(pipeline.send(httpRequest, CONTEXT)) .verifyComplete(); - + sh.flush(); String logString = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); Assertions.assertTrue(logString.contains(expectedQueryString)); } - private static Stream redactQueryParametersSupplier() { - String requestUrl = "https://localhost?sensitiveQueryParameter=sensitiveValue&queryParameter=value"; - - String expectedFormat = "sensitiveQueryParameter=%s&queryParameter=%s"; - String fullyRedactedQueryString = String.format(expectedFormat, REDACTED, REDACTED); - String sensitiveRedactionQueryString = String.format(expectedFormat, REDACTED, "value"); - String fullyAllowedQueryString = String.format(expectedFormat, "sensitiveValue", "value"); - - Set allQueryParameters = new HashSet<>(); - allQueryParameters.add("sensitiveQueryParameter"); - allQueryParameters.add("queryParameter"); - - return Stream.of( - // All query parameters should be redacted. - Arguments.of(requestUrl, fullyRedactedQueryString, new HashSet()), - - // Only the sensitive query parameter should be redacted. - Arguments.of(requestUrl, sensitiveRedactionQueryString, Collections.singleton("queryParameter")), - - // No query parameters are redacted. - Arguments.of(requestUrl, fullyAllowedQueryString, allQueryParameters) - ); - } - /** * Tests that logging the request body doesn't consume the stream before it is sent over the network. */ @@ -137,21 +117,26 @@ private static Stream redactQueryParametersSupplier() { public void validateLoggingDoesNotConsumeRequest(Flux stream, byte[] data, int contentLength) throws MalformedURLException { URL requestUrl = new URL("https://test.com"); + HttpLoggingPolicy loggingPolicy = new HttpLoggingPolicy(new HttpLogOptions() + .setLogLevel(HttpLogDetailLevel.BODY)); + HttpHeaders requestHeaders = new HttpHeaders() .put("Content-Type", ContentType.APPLICATION_JSON) .put("Content-Length", Integer.toString(contentLength)); + HttpRequest httpRequest = new HttpRequest(HttpMethod.POST, requestUrl, requestHeaders, stream); + mockLoggerForLoggingPolicyRequest(loggingPolicy, httpRequest); + HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY))) + .policies(loggingPolicy) .httpClient(request -> FluxUtil.collectBytesInByteBufferStream(request.getBody()) .doOnSuccess(bytes -> assertArrayEquals(data, bytes)) .then(Mono.empty())) .build(); - StepVerifier.create(pipeline.send(new HttpRequest(HttpMethod.POST, requestUrl, requestHeaders, stream), - CONTEXT)) + StepVerifier.create(pipeline.send(httpRequest)) .verifyComplete(); - + sh.flush(); String logString = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); System.out.println(logString); Assertions.assertTrue(logString.contains(new String(data, StandardCharsets.UTF_8))); @@ -167,23 +152,77 @@ public void validateLoggingDoesNotConsumeResponse(Flux stream, byte[ HttpHeaders responseHeaders = new HttpHeaders() .put("Content-Type", ContentType.APPLICATION_JSON) .put("Content-Length", Integer.toString(contentLength)); + HttpLoggingPolicy loggingPolicy = new HttpLoggingPolicy(new HttpLogOptions() + .setLogLevel(HttpLogDetailLevel.BODY)); + HttpResponse httpResponse = new MockHttpResponse(request, responseHeaders, stream); + Mono responseMono = mockLoggerForLoggingPolicyResponse(loggingPolicy, httpResponse); - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY))) - .httpClient(ignored -> Mono.just(new MockHttpResponse(ignored, responseHeaders, stream))) - .build(); - - StepVerifier.create(pipeline.send(request, CONTEXT)) + StepVerifier.create(responseMono) .assertNext(response -> StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(response.getBody())) .assertNext(bytes -> assertArrayEquals(data, bytes)) .verifyComplete()) .verifyComplete(); - + sh.flush(); String logString = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); System.out.println(logString); Assertions.assertTrue(logString.contains(new String(data, StandardCharsets.UTF_8))); } + + private void mockLoggerForLoggingPolicyRequest(HttpLoggingPolicy loggingPolicy, HttpRequest request) { + try { + ClientLogger logger = new ClientLogger("testRequest"); + Field f = ClientLogger.class.getDeclaredField("defaultLogger"); + f.setAccessible(true); + f.set(logger, mockLogger); + Method method = HttpLoggingPolicy.class.getDeclaredMethod("logRequest", ClientLogger.class, HttpRequest.class); + method.setAccessible(true); + method.invoke(loggingPolicy, logger, request); + } catch (Exception e) { + fail("The tests encounter some reflection issues."); + } + } + + @SuppressWarnings("unchecked") + private Mono mockLoggerForLoggingPolicyResponse(HttpLoggingPolicy loggingPolicy, HttpResponse response) { + try { + ClientLogger logger = new ClientLogger("testResponse"); + Field f = ClientLogger.class.getDeclaredField("defaultLogger"); + f.setAccessible(true); + f.set(logger, mockLogger); + Method method = HttpLoggingPolicy.class.getDeclaredMethod("logResponse", ClientLogger.class, HttpResponse.class, long.class); + method.setAccessible(true); + return (Mono) method.invoke(loggingPolicy, logger, response, 0L); + } catch (Exception e) { + Mono.error(new RuntimeException("The tests encounter some reflection issues.")); + } + return Mono.justOrEmpty(response); + } + + private static Stream redactQueryParametersSupplier() { + String requestUrl = "https://localhost?sensitiveQueryParameter=sensitiveValue&queryParameter=value"; + + String expectedFormat = "sensitiveQueryParameter=%s&queryParameter=%s"; + String fullyRedactedQueryString = String.format(expectedFormat, REDACTED, REDACTED); + String sensitiveRedactionQueryString = String.format(expectedFormat, REDACTED, "value"); + String fullyAllowedQueryString = String.format(expectedFormat, "sensitiveValue", "value"); + + Set allQueryParameters = new HashSet<>(); + allQueryParameters.add("sensitiveQueryParameter"); + allQueryParameters.add("queryParameter"); + + return Stream.of( + // All query parameters should be redacted. + Arguments.of(requestUrl, fullyRedactedQueryString, new HashSet()), + + // Only the sensitive query parameter should be redacted. + Arguments.of(requestUrl, sensitiveRedactionQueryString, Collections.singleton("queryParameter")), + + // No query parameters are redacted. + Arguments.of(requestUrl, fullyAllowedQueryString, allQueryParameters) + ); + } + private static Stream validateLoggingDoesNotConsumeSupplier() { byte[] data = "this is a test".getBytes(StandardCharsets.UTF_8); byte[] repeatingData = new byte[data.length * 3]; diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java index be652413517d..e72e0337f4fa 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java @@ -4,18 +4,28 @@ package com.azure.core.util.logging; import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; +import java.util.logging.StreamHandler; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.nio.charset.StandardCharsets; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -25,39 +35,34 @@ public class ClientLoggerTests { private static final String PARAMETERIZED_TEST_NAME_TEMPLATE = "[" + ParameterizedTest.INDEX_PLACEHOLDER + "] " + ParameterizedTest.DISPLAY_NAME_PLACEHOLDER; - private PrintStream originalSystemErr; private ByteArrayOutputStream logCaptureStream; + private StreamHandler sh; + + private Logger mockLogger; + private ClientLogger clientLogger; @BeforeEach - public void setupLoggingConfiguration() { - /* - * Indicate to SLF4J to enable trace level logging for a logger named - * com.azure.core.util.logging.ClientLoggerTests. Trace is the maximum level of logging supported by the - * ClientLogger. - */ - System.setProperty("org.slf4j.simpleLogger.log.com.azure.core.util.logging.ClientLoggerTests", "trace"); - - /* - * The default configuration for SLF4J's SimpleLogger uses System.err to log. Inject a custom PrintStream to - * log into for the duration of the test to capture the log messages. - */ - originalSystemErr = System.err; + public void setupLoggingConfiguration() throws Exception { + InputStream stream = ClientLoggerTests.class.getClassLoader(). + getResourceAsStream("logging.properties"); + LogManager.getLogManager().readConfiguration(stream); + new ClientLogger("test").verbose("I am talking"); logCaptureStream = new ByteArrayOutputStream(); - System.setErr(new PrintStream(logCaptureStream)); + PrintStream ps = new PrintStream(logCaptureStream); + sh = new StreamHandler(ps, new SimpleFormatter()); + sh.setLevel(Level.FINEST); + clientLogger = new ClientLogger(ClientLoggerTests.class); + mockLogger = Logger.getLogger("test"); + mockLogger.addHandler(sh); + Field f = ClientLogger.class.getDeclaredField("defaultLogger"); + f.setAccessible(true); + f.set(clientLogger, mockLogger); } @AfterEach - public void revertLoggingConfiguration() { - System.clearProperty("org.slf4j.simpleLogger.log.com.azure.core.util.logging.ClientLoggerTests"); - System.setErr(originalSystemErr); - } - - private void setPropertyToOriginalOrClear(String propertyName, String originalValue) { - if (CoreUtils.isNullOrEmpty(originalValue)) { - System.clearProperty(propertyName); - } else { - System.setProperty(propertyName, originalValue); - } + public void revertLoggingConfiguration() throws Exception { + sh.close(); + logCaptureStream.close(); } /** @@ -67,14 +72,13 @@ private void setPropertyToOriginalOrClear(String propertyName, String originalVa */ @ParameterizedTest(name = PARAMETERIZED_TEST_NAME_TEMPLATE) @ValueSource(ints = { 1, 2, 3, 4 }) - public void logAtSupportedLevel(int logLevel) { + public void logAtSupportedLevelAtBinding(int logLevel) { + setupLogLevel(logLevel); String logMessage = "This is a test"; + logMessage(clientLogger, logLevel, logMessage); - String originalLogLevel = setupLogLevel(logLevel); - logMessage(new ClientLogger(ClientLoggerTests.class), logLevel, logMessage); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); - - String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); + sh.flush(); + String logValues = logCaptureStream.toString(StandardCharsets.UTF_8); assertTrue(logValues.contains(logMessage)); } @@ -84,34 +88,24 @@ public void logAtSupportedLevel(int logLevel) { * @param logLevel Logging level to log a message */ @ParameterizedTest(name = PARAMETERIZED_TEST_NAME_TEMPLATE) - @ValueSource(ints = { 1, 2, 3 }) + @ValueSource(ints = {1, 2, 3 }) public void logAtUnsupportedLevel(int logLevel) { String logMessage = "This is a test"; - String originalLogLevel = setupLogLevel(logLevel + 1); - logMessage(new ClientLogger(ClientLoggerTests.class), logLevel, logMessage); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); + setupLogLevel(logLevel + 1); + logMessage(clientLogger, logLevel, logMessage); + sh.flush(); String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); - assertFalse(logValues.contains(logMessage)); + assertTrue(logValues.isEmpty()); } /** * Tests that logging when the environment log level is disabled nothing is logged. - * - * @param logLevel Logging level to log a message */ - @ParameterizedTest(name = PARAMETERIZED_TEST_NAME_TEMPLATE) - @ValueSource(ints = { 1, 2, 3, 4 }) - public void logWhenLoggingDisabled(int logLevel) { - String logMessage = "This is a test"; - - String originalLogLevel = setupLogLevel(5); - logMessage(new ClientLogger(ClientLoggerTests.class), logLevel, logMessage); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); - - String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); - assertFalse(logValues.contains(logMessage)); + @Test + public void logWhenLoggingNotSet() { + assertEquals(LogLevel.NOT_SET, LogLevel.fromString(null)); } /** @@ -123,52 +117,13 @@ public void onlyLogExceptionMessage() { String exceptionMessage = "An exception message"; RuntimeException runtimeException = createRuntimeException(exceptionMessage); - String originalLogLevel = setupLogLevel(2); - logMessage(new ClientLogger(ClientLoggerTests.class), 3, logMessage, runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); - - String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); - assertTrue(logValues.contains(logMessage + System.lineSeparator() + runtimeException.getMessage())); - assertFalse(logValues.contains(runtimeException.getStackTrace()[0].toString())); - } - - /** - * Tests that logging an exception when the log level is VERBOSE the stack trace is logged. - */ - @Test - public void logExceptionStackTrace() { - String logMessage = "This is an exception"; - String exceptionMessage = "An exception message"; - RuntimeException runtimeException = createRuntimeException(exceptionMessage); - - String originalLogLevel = setupLogLevel(1); - logMessage(new ClientLogger(ClientLoggerTests.class), 3, logMessage, runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); - - String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); - assertTrue(logValues.contains(logMessage + System.lineSeparator() + runtimeException.getMessage())); - assertTrue(logValues.contains(runtimeException.getStackTrace()[0].toString())); - } - - /** - * Tests that logging an exception when the log level is ERROR the stack trace is logged. - */ - @Test - public void logExceptionStackTraceWithErrorLevel() { - String logMessage = "This is an exception"; - String exceptionMessage = "An exception message"; - RuntimeException runtimeException = createRuntimeException(exceptionMessage); - - String originalLogLevel = setupLogLevel(1); - logMessage(new ClientLogger(ClientLoggerTests.class), 4, logMessage, runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); - + setupLogLevel(2); + logMessage(clientLogger, 3, logMessage, runtimeException); + sh.flush(); String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); assertTrue(logValues.contains(logMessage + System.lineSeparator() + runtimeException.getMessage())); - assertTrue(logValues.contains(runtimeException.getStackTrace()[0].toString())); } - /** * Tests that logging an exception when the log level is ERROR the stack trace is logged. */ @@ -178,9 +133,8 @@ public void logExceptionStackTraceWithNoLogLevel() { String exceptionMessage = "An exception message"; RuntimeException runtimeException = createRuntimeException(exceptionMessage); - String originalLogLevel = setupLogLevel(1); - logMessage(new ClientLogger(ClientLoggerTests.class), 5, logMessage, runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); + setupLogLevel(1); + logMessage(clientLogger, 5, logMessage, runtimeException); String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); assertTrue(logValues.isEmpty()); @@ -194,14 +148,26 @@ public void logExceptionWithInvalidLogLevel() { String logMessage = "This is an exception"; Object runtimeException = new Object(); - String originalLogLevel = setupLogLevel(1); - logMessage(new ClientLogger(ClientLoggerTests.class), 3, logMessage, runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); + setupLogLevel(1); + logMessage(clientLogger, 3, logMessage, runtimeException); + sh.flush(); String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); assertTrue(logValues.contains(logMessage)); } +// @Test +// public void testNoBindingNoEnv() { +// String logMessage = "This is an exception"; +// +// System.clearProperty(Configuration.PROPERTY_AZURE_LOG_LEVEL); +// logMessage(clientLogger, 4, logMessage); +// sh.flush(); +// +// String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); +// assertTrue(logValues.isEmpty()); +// } + /** * Tests that logging an exception as warning won't include the stack trace when the environment log level isn't * VERBOSE. Additionally, this tests that the exception message isn't logged twice as logging an exception uses @@ -212,31 +178,12 @@ public void logExceptionAsWarningOnlyExceptionMessage() { String exceptionMessage = "An exception message"; RuntimeException runtimeException = createRuntimeException(exceptionMessage); - String originalLogLevel = setupLogLevel(2); - new ClientLogger(ClientLoggerTests.class).logExceptionAsWarning(runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); - - String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); - assertTrue(logValues.contains(exceptionMessage + System.lineSeparator())); - assertFalse(logValues.contains(runtimeException.getStackTrace()[0].toString())); - } - - /** - * Tests that logging an exception as warning will include the stack trace when the environment log level is set to - * VERBOSE. - */ - @Test - public void logExceptionAsWarningStackTrace() { - String exceptionMessage = "An exception message"; - RuntimeException runtimeException = createRuntimeException(exceptionMessage); - - String originalLogLevel = setupLogLevel(1); - new ClientLogger(ClientLoggerTests.class).logExceptionAsWarning(runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); + setupLogLevel(1); + clientLogger.logExceptionAsWarning(runtimeException); + sh.flush(); String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); assertTrue(logValues.contains(exceptionMessage + System.lineSeparator())); - assertTrue(logValues.contains(runtimeException.getStackTrace()[0].toString())); } /** @@ -249,38 +196,31 @@ public void logExceptionAsErrorOnlyExceptionMessage() { String exceptionMessage = "An exception message"; RuntimeException runtimeException = createRuntimeException(exceptionMessage); - String originalLogLevel = setupLogLevel(2); - new ClientLogger(ClientLoggerTests.class).logExceptionAsError(runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); + setupLogLevel(2); + clientLogger.logExceptionAsError(runtimeException); + sh.flush(); String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); assertTrue(logValues.contains(exceptionMessage + System.lineSeparator())); assertFalse(logValues.contains(runtimeException.getStackTrace()[0].toString())); } - /** - * Tests that logging an exception as error will include the stack trace when the environment log level is set to - * VERBOSE. - */ - @Test - public void logExceptionAsErrorStackTrace() { - String exceptionMessage = "An exception message"; - RuntimeException runtimeException = createRuntimeException(exceptionMessage); + @ParameterizedTest(name = "{index} from logLevelToConfigure = {0}, logLevelToValidate = {1}, expected = {2}") + @CsvSource({"1, 1, true", "1, 2, true", "1, 3, true", "1, 4, true", "2, 1, false", "1, VERBOSE, true", "1, info, true", "1, warning, true", "1, error, true", "2, verbose, false"}) + public void canLogAtLevel(int logLevelToConfigure, String logLevelToValidate, boolean expected) { + setupLogLevel(logLevelToConfigure); - String originalLogLevel = setupLogLevel(1); - new ClientLogger(ClientLoggerTests.class).logExceptionAsError(runtimeException); - setPropertyToOriginalOrClear(Configuration.PROPERTY_AZURE_LOG_LEVEL, originalLogLevel); + LogLevel logLevel = LogLevel.fromString(logLevelToValidate); + assertEquals(new ClientLogger(UUID.randomUUID().toString()).canLogAtLevel(logLevel), expected); + } - String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); - assertTrue(logValues.contains(exceptionMessage + System.lineSeparator())); - assertTrue(logValues.contains(runtimeException.getStackTrace()[0].toString())); + @Test + public void canLogAtLevelInvalid() { + assertThrows(IllegalArgumentException.class, () -> LogLevel.fromString("5")); } - private String setupLogLevel(int logLevelToSet) { - String originalLogLevel = Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_CLOUD); + private void setupLogLevel(int logLevelToSet) { System.setProperty(Configuration.PROPERTY_AZURE_LOG_LEVEL, Integer.toString(logLevelToSet)); - - return originalLogLevel; } private void logMessage(ClientLogger logger, int logLevelToLog, String logFormat, Object... arguments) { @@ -310,4 +250,5 @@ private RuntimeException createRuntimeException(String message) { return runtimeException; } + } diff --git a/sdk/cosmos/CODEOWNERS b/sdk/cosmos/CODEOWNERS index 26da20e9f2cf..732eb0de8569 100644 --- a/sdk/cosmos/CODEOWNERS +++ b/sdk/cosmos/CODEOWNERS @@ -7,4 +7,4 @@ # https://help.github.com/articles/about-codeowners/ # Default owner for repo -* @moderakh @christopheranderson @kushagraThapar +* @moderakh @kushagraThapar @David-Noble-at-work @kirankumarkolli diff --git a/sdk/cosmos/README.md b/sdk/cosmos/README.md index 056900c0d8bc..3a5b1b1930cb 100644 --- a/sdk/cosmos/README.md +++ b/sdk/cosmos/README.md @@ -92,7 +92,7 @@ For example, using maven, you can add the following dependency to your maven pom com.microsoft.azure azure-cosmos - 3.5.0 + 3.6.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/cosmos/changelog/README.md b/sdk/cosmos/changelog/README.md index 97ddeccad803..233a8fbfc327 100644 --- a/sdk/cosmos/changelog/README.md +++ b/sdk/cosmos/changelog/README.md @@ -1,5 +1,30 @@ ## Changelog - +### 3.6.0-beta.1 +- Added the ability to select default Direct TCP options + + In priority order we will take default Direct TCP options from: + + - The string value of system property `"azure.cosmos.directTcp.options"` + + Example: + ``` + -Dazure.cosmos.directTcp.defaultOptions={\"idleEndpointTimeout\":"PT1M10S",\"maxChannelsPerEndpoint\":10,\"maxRequestsPerChannel\":30} + ``` + - The contents of the file located by the system property "azure.cosmos.directTcp.defaultOptionsFile". + + Example: + ``` + -Dazure.cosmos.directTcp.defaultOptionsFile=/path/to/default/options/file + ``` + + - The contents of the resource file named `"azure.cosmos.directTcp.options.json"` + + Otherwise, if none of these values are set or an error occurs we create default options based on a set of hard-wired + values defined in the default private parameterless constructor for `RntbdTransportClient.Options` as we did before + this release. + +- Fixed Reactor Netty connection re-use issue: https://github.com/Azure/azure-sdk-for-java/issues/6973 + ### 3.5.0 - Changefeed bug fixes (includes all the bug fixes released in 3.3.3) - Disaster Recovery related bug fixes diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml index c205f0b2551e..6c03a5106eff 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml @@ -13,7 +13,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-benchmark - 3.5.0 + 3.6.0-beta.2 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service - Benchmarking tool This package contains Benchmarking tool for Microsoft Azure SDK for SQL API of Azure Cosmos DB Service https://github.com/Azure/azure-sdk-for-java @@ -33,7 +33,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos - 3.5.0 + 3.6.0-beta.2 diff --git a/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml index bb518ae05a9b..6725d42a1bcd 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml @@ -13,7 +13,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-examples - 3.5.0 + 3.6.0-beta.2 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service - Examples This package contains examples for Microsoft Azure SDK for SQL API of Azure Cosmos DB Service https://github.com/Azure/azure-sdk-for-java @@ -94,7 +94,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos - 3.5.0 + 3.6.0-beta.2 diff --git a/sdk/cosmos/microsoft-azure-cosmos/pom.xml b/sdk/cosmos/microsoft-azure-cosmos/pom.xml index 1e4e938a3e28..17da84c78138 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos/pom.xml @@ -12,7 +12,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos - 3.5.0 + 3.6.0-beta.2 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension rx support) for Azure Cosmos DB SQL API jar @@ -36,6 +36,12 @@ Licensed under the MIT License. 2.10.0 + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.10.0 + + com.fasterxml.uuid java-uuid-generator diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java index 767ced3bd2a5..f16d56835a97 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java @@ -257,7 +257,7 @@ public static class Versions { // @see // https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven // {x-version-update-start;com.microsoft.azure:azure-cosmos;current} - public static final String SDK_VERSION = "3.5.0"; + public static final String SDK_VERSION = "3.6.0-beta.2"; // {x-version-update-end} public static final String SDK_NAME = "cosmosdb-java-sdk"; } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java index 930a371e6a79..ea42e143ae13 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java @@ -11,6 +11,8 @@ import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestArgs; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestRecord; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdServiceEndpoint; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -23,7 +25,9 @@ import reactor.core.publisher.Mono; import reactor.core.publisher.SignalType; +import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.net.URI; import java.time.Duration; import java.util.Iterator; @@ -158,42 +162,88 @@ public static final class Options { // region Fields + @JsonProperty() private final int bufferPageSize; - private final String certificateHostNameOverride; + + @JsonProperty() private final Duration connectionTimeout; + + @JsonProperty() private final Duration idleChannelTimeout; + + @JsonProperty() private final Duration idleEndpointTimeout; + + @JsonProperty() private final int maxBufferCapacity; + + @JsonProperty() private final int maxChannelsPerEndpoint; + + @JsonProperty() private final int maxRequestsPerChannel; - private final int partitionCount; + + @JsonProperty() private final Duration receiveHangDetectionTime; + + @JsonProperty() private final Duration requestExpiryInterval; + + @JsonProperty() private final Duration requestTimeout; + + @JsonProperty() + private final Duration requestTimerResolution; + + @JsonProperty() private final Duration sendHangDetectionTime; + + @JsonProperty() private final Duration shutdownTimeout; + + @JsonIgnore() private final UserAgentContainer userAgent; // endregion // region Constructors + private Options() { + this.bufferPageSize = 8192; + this.connectionTimeout = null; + this.idleChannelTimeout = Duration.ZERO; + this.idleEndpointTimeout = Duration.ofSeconds(70L); + this.maxBufferCapacity = 8192 << 10; + this.maxChannelsPerEndpoint = 10; + this.maxRequestsPerChannel = 30; + this.receiveHangDetectionTime = Duration.ofSeconds(65L); + this.requestExpiryInterval = Duration.ofSeconds(5L); + this.requestTimeout = null; + this.requestTimerResolution = Duration.ofMillis(5L); + this.sendHangDetectionTime = Duration.ofSeconds(10L); + this.shutdownTimeout = Duration.ofSeconds(15L); + this.userAgent = new UserAgentContainer(); + } + private Options(Builder builder) { + this.bufferPageSize = builder.bufferPageSize; - this.certificateHostNameOverride = builder.certificateHostNameOverride; - this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; this.idleChannelTimeout = builder.idleChannelTimeout; this.idleEndpointTimeout = builder.idleEndpointTimeout; this.maxBufferCapacity = builder.maxBufferCapacity; this.maxChannelsPerEndpoint = builder.maxChannelsPerEndpoint; this.maxRequestsPerChannel = builder.maxRequestsPerChannel; - this.partitionCount = builder.partitionCount; this.receiveHangDetectionTime = builder.receiveHangDetectionTime; this.requestExpiryInterval = builder.requestExpiryInterval; this.requestTimeout = builder.requestTimeout; + this.requestTimerResolution = builder.requestTimerResolution; this.sendHangDetectionTime = builder.sendHangDetectionTime; this.shutdownTimeout = builder.shutdownTimeout; this.userAgent = builder.userAgent; + + this.connectionTimeout = builder.connectionTimeout == null + ? builder.requestTimeout + : builder.connectionTimeout; } // endregion @@ -204,10 +254,6 @@ public int bufferPageSize() { return this.bufferPageSize; } - public String certificateHostNameOverride() { - return this.certificateHostNameOverride; - } - public Duration connectionTimeout() { return this.connectionTimeout; } @@ -232,10 +278,6 @@ public int maxRequestsPerChannel() { return this.maxRequestsPerChannel; } - public int partitionCount() { - return this.partitionCount; - } - public Duration receiveHangDetectionTime() { return this.receiveHangDetectionTime; } @@ -248,6 +290,10 @@ public Duration requestTimeout() { return this.requestTimeout; } + public Duration requestTimerResolution() { + return this.requestTimerResolution; + } + public Duration sendHangDetectionTime() { return this.sendHangDetectionTime; } @@ -273,39 +319,110 @@ public String toString() { // region Types + @SuppressWarnings("UnusedReturnValue") public static class Builder { // region Fields - private static final UserAgentContainer DEFAULT_USER_AGENT_CONTAINER = new UserAgentContainer(); - private static final Duration FIFTEEN_SECONDS = Duration.ofSeconds(15L); - private static final Duration FIVE_SECONDS =Duration.ofSeconds(5L); - private static final Duration SEVENTY_SECONDS = Duration.ofSeconds(70L); - private static final Duration SIXTY_FIVE_SECONDS = Duration.ofSeconds(65L); - private static final Duration TEN_SECONDS = Duration.ofSeconds(10L); - - private int bufferPageSize = 8192; - private String certificateHostNameOverride = null; - private Duration connectionTimeout = null; - private Duration idleChannelTimeout = Duration.ZERO; - private Duration idleEndpointTimeout = SEVENTY_SECONDS; - private int maxBufferCapacity = 8192 << 10; - private int maxChannelsPerEndpoint = 10; - private int maxRequestsPerChannel = 30; - private int partitionCount = 1; - private Duration receiveHangDetectionTime = SIXTY_FIVE_SECONDS; - private Duration requestExpiryInterval = FIVE_SECONDS; + private static final String DEFAULT_OPTIONS_PROPERTY_NAME = "azure.cosmos.directTcp.defaultOptions"; + private static final Options DEFAULT_OPTIONS; + + static { + + // In priority order we take default Direct TCP options from: + // + // 1. the string value of system property "azure.cosmos.directTcp.options", or + // 2. the contents of the file located by the system property "azure.cosmos.directTcp.optionsFile", or + // 3. the contents of the resource file named "azure.cosmos.directTcp.options.json" + // + // Otherwise, if none of these values are set or an error occurs we create default options based on a + // set of hard-wired values defined in the default private parameterless constructor for + // RntbdTransportClient.Options. + + Options options = null; + + try { + final String string = System.getProperty(DEFAULT_OPTIONS_PROPERTY_NAME); + + if (string != null) { + // Attempt to set default options based on the JSON string value of "{propertyName}" + try { + options = RntbdObjectMapper.readValue(string, Options.class); + } catch (IOException error) { + logger.error("failed to parse default Direct TCP options {} due to ", string, error); + } + } + + if (options == null) { + + final String path = System.getProperty(DEFAULT_OPTIONS_PROPERTY_NAME + "File"); + + if (path != null) { + // Attempt to load default options from the JSON file on the path specified by + // "{propertyName}File" + try { + options = RntbdObjectMapper.readValue(new File(path), Options.class); + } catch (IOException error) { + logger.error("failed to load default Direct TCP options from {} due to ", path, error); + } + } + } + + if (options == null) { + + final ClassLoader loader = RntbdTransportClient.class.getClassLoader(); + final String name = DEFAULT_OPTIONS_PROPERTY_NAME + ".json"; + + try (final InputStream stream = loader.getResourceAsStream(name)) { + if (stream != null) { + // Attempt to load default options from the JSON resource file "{propertyName}.json" + options = RntbdObjectMapper.readValue(stream, Options.class); + } + } catch (IOException error) { + logger.error("failed to load Direct TCP options from resource {} due to ", name, error); + } + } + } finally { + DEFAULT_OPTIONS = options != null ? options : new Options(); + } + } + + private int bufferPageSize; + private Duration connectionTimeout; + private Duration idleChannelTimeout; + private Duration idleEndpointTimeout; + private int maxBufferCapacity; + private int maxChannelsPerEndpoint; + private int maxRequestsPerChannel; + private Duration receiveHangDetectionTime; + private Duration requestExpiryInterval; private Duration requestTimeout; - private Duration sendHangDetectionTime = TEN_SECONDS; - private Duration shutdownTimeout = FIFTEEN_SECONDS; - private UserAgentContainer userAgent = DEFAULT_USER_AGENT_CONTAINER; + private Duration requestTimerResolution; + private Duration sendHangDetectionTime; + private Duration shutdownTimeout; + private UserAgentContainer userAgent; // endregion // region Constructors public Builder(Duration requestTimeout) { + this.requestTimeout(requestTimeout); + + this.bufferPageSize = DEFAULT_OPTIONS.bufferPageSize; + this.connectionTimeout = DEFAULT_OPTIONS.connectionTimeout; + this.idleChannelTimeout = DEFAULT_OPTIONS.idleChannelTimeout; + this.idleEndpointTimeout = DEFAULT_OPTIONS.idleEndpointTimeout; + this.maxBufferCapacity = DEFAULT_OPTIONS.maxBufferCapacity; + this.maxChannelsPerEndpoint = DEFAULT_OPTIONS.maxChannelsPerEndpoint; + this.maxRequestsPerChannel = DEFAULT_OPTIONS.maxRequestsPerChannel; + this.receiveHangDetectionTime = DEFAULT_OPTIONS.receiveHangDetectionTime; + this.requestExpiryInterval = DEFAULT_OPTIONS.requestExpiryInterval; + this.requestTimerResolution = DEFAULT_OPTIONS.requestTimerResolution; + this.sendHangDetectionTime = DEFAULT_OPTIONS.sendHangDetectionTime; + this.shutdownTimeout = DEFAULT_OPTIONS.shutdownTimeout; + this.userAgent = DEFAULT_OPTIONS.userAgent; } public Builder(int requestTimeoutInSeconds) { @@ -332,11 +449,6 @@ public Options build() { return new Options(this); } - public Builder certificateHostNameOverride(final String value) { - this.certificateHostNameOverride = value; - return this; - } - public Builder connectionTimeout(final Duration value) { checkArgument(value == null || value.compareTo(Duration.ZERO) > 0, "expected positive value, not %s", @@ -379,12 +491,6 @@ public Builder maxRequestsPerChannel(final int value) { return this; } - public Builder partitionCount(final int value) { - checkArgument(value > 0, "expected positive value, not %s", value); - this.partitionCount = value; - return this; - } - public Builder receiveHangDetectionTime(final Duration value) { checkArgument(value != null && value.compareTo(Duration.ZERO) > 0, "expected positive value, not %s", @@ -409,6 +515,14 @@ public Builder requestTimeout(final Duration value) { return this; } + public Builder requestTimerResolution(final Duration value) { + checkArgument(value != null && value.compareTo(Duration.ZERO) > 0, + "expected positive value, not %s", + value); + this.requestTimerResolution = value; + return this; + } + public Builder sendHangDetectionTime(final Duration value) { checkArgument(value != null && value.compareTo(Duration.ZERO) > 0, "expected positive value, not %s", diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java index 39d09c241a0f..c1020f01988a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java @@ -32,34 +32,34 @@ public final class RntbdClientChannelHealthChecker implements ChannelHealthCheck private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelHealthChecker.class); // A channel will be declared healthy if a read succeeded recently as defined by this value. - private static final long recentReadWindow = 1_000_000_000L; + private static final long recentReadWindowInNanos = 1_000_000_000L; // A channel should not be declared unhealthy if a write succeeded recently. As such gaps between // Timestamps.lastChannelWrite and Timestamps.lastChannelRead lower than this value are ignored. // Guidance: The grace period should be large enough to accommodate the round trip time of the slowest server // request. Assuming 1s of network RTT, a 2 MB request, a 2 MB response, a connection that can sustain 1 MB/s // both ways, and a 5-second deadline at the server, 10 seconds should be enough. - private static final long readHangGracePeriod = 10L * 1_000_000_000L; + private static final long readHangGracePeriodInNanos = 10L * 1_000_000_000L; // A channel will not be declared unhealthy if a write was attempted recently. As such gaps between // Timestamps.lastChannelWriteAttempt and Timestamps.lastChannelWrite lower than this value are ignored. // Guidance: The grace period should be large enough to accommodate slow writes. For example, a value of 2s requires // that the client can sustain data rates of at least 1 MB/s when writing 2 MB documents. - private static final long writeHangGracePeriod = 2L * 1_000_000_000L; + private static final long writeHangGracePeriodInNanos = 2L * 1_000_000_000L; // A channel is considered idle if: // idleConnectionTimeout > 0L && System.nanoTime() - Timestamps.lastChannelRead() >= idleConnectionTimeout - private final long idleConnectionTimeout; + private final long idleConnectionTimeoutInNanos; // A channel will be declared unhealthy if the gap between Timestamps.lastChannelWrite and Timestamps.lastChannelRead // grows beyond this value. // Constraint: readDelayLimit > readHangGracePeriod - private final long readDelayLimit; + private final long readDelayLimitInNanos; // A channel will be declared unhealthy if the gap between Timestamps.lastChannelWriteAttempt and Timestamps.lastChannelWrite // grows beyond this value. // Constraint: writeDelayLimit > writeHangGracePeriod - private final long writeDelayLimit; + private final long writeDelayLimitInNanos; // endregion @@ -69,29 +69,29 @@ public RntbdClientChannelHealthChecker(final Config config) { checkNotNull(config, "config: null"); - this.idleConnectionTimeout = config.idleConnectionTimeoutInNanos(); + this.idleConnectionTimeoutInNanos = config.idleConnectionTimeoutInNanos(); - this.readDelayLimit = config.receiveHangDetectionTimeInNanos(); - checkArgument(this.readDelayLimit > readHangGracePeriod, "config.receiveHangDetectionTime: %s", this.readDelayLimit); + this.readDelayLimitInNanos = config.receiveHangDetectionTimeInNanos(); + checkArgument(this.readDelayLimitInNanos > readHangGracePeriodInNanos, "config.receiveHangDetectionTimeInNanos: %s", this.readDelayLimitInNanos); - this.writeDelayLimit = config.sendHangDetectionTimeInNanos(); - checkArgument(this.writeDelayLimit > writeHangGracePeriod, "config.sendHangDetectionTime: %s", this.writeDelayLimit); + this.writeDelayLimitInNanos = config.sendHangDetectionTimeInNanos(); + checkArgument(this.writeDelayLimitInNanos > writeHangGracePeriodInNanos, "config.sendHangDetectionTimeInNanos: %s", this.writeDelayLimitInNanos); } // endregion // region Methods - public long idleConnectionTimeout() { - return this.idleConnectionTimeout; + public long idleConnectionTimeoutInNanos() { + return this.idleConnectionTimeoutInNanos; } - public long readDelayLimit() { - return this.readDelayLimit; + public long readDelayLimitInNanos() { + return this.readDelayLimitInNanos; } - public long writeDelayLimit() { - return this.writeDelayLimit; + public long writeDelayLimitInNanos() { + return this.writeDelayLimitInNanos; } public Future isHealthy(final Channel channel) { @@ -109,7 +109,7 @@ public Future isHealthy(final Channel channel) { final Timestamps timestamps = requestManager.snapshotTimestamps(); final long currentTime = System.nanoTime(); - if (currentTime - timestamps.lastChannelRead() < recentReadWindow) { + if (currentTime - timestamps.lastChannelRead() < recentReadWindowInNanos) { return promise.setSuccess(Boolean.TRUE); // because we recently received data } @@ -119,7 +119,7 @@ public Future isHealthy(final Channel channel) { final long writeDelay = timestamps.lastChannelWriteAttempt() - timestamps.lastChannelWrite(); - if (writeDelay > this.writeDelayLimit && currentTime - timestamps.lastChannelWriteAttempt() > writeHangGracePeriod) { + if (writeDelay > this.writeDelayLimitInNanos && currentTime - timestamps.lastChannelWriteAttempt() > writeHangGracePeriodInNanos) { final Optional rntbdContext = requestManager.rntbdContext(); final int pendingRequestCount = requestManager.pendingRequestCount(); @@ -127,7 +127,7 @@ public Future isHealthy(final Channel channel) { logger.warn("{} health check failed due to hung write: {lastChannelWriteAttempt: {}, lastChannelWrite: {}, " + "writeDelay: {}, writeDelayLimit: {}, rntbdContext: {}, pendingRequestCount: {}}", channel, timestamps.lastChannelWriteAttempt(), timestamps.lastChannelWrite(), writeDelay, - this.writeDelayLimit, rntbdContext, pendingRequestCount); + this.writeDelayLimitInNanos, rntbdContext, pendingRequestCount); return promise.setSuccess(Boolean.FALSE); } @@ -138,7 +138,7 @@ public Future isHealthy(final Channel channel) { final long readDelay = timestamps.lastChannelWrite() - timestamps.lastChannelRead(); - if (readDelay > this.readDelayLimit && currentTime - timestamps.lastChannelWrite() > readHangGracePeriod) { + if (readDelay > this.readDelayLimitInNanos && currentTime - timestamps.lastChannelWrite() > readHangGracePeriodInNanos) { final Optional rntbdContext = requestManager.rntbdContext(); final int pendingRequestCount = requestManager.pendingRequestCount(); @@ -146,13 +146,13 @@ public Future isHealthy(final Channel channel) { logger.warn("{} health check failed due to hung read: {lastChannelWrite: {}, lastChannelRead: {}, " + "readDelay: {}, readDelayLimit: {}, rntbdContext: {}, pendingRequestCount: {}}", channel, timestamps.lastChannelWrite(), timestamps.lastChannelRead(), readDelay, - this.readDelayLimit, rntbdContext, pendingRequestCount); + this.readDelayLimitInNanos, rntbdContext, pendingRequestCount); return promise.setSuccess(Boolean.FALSE); } - if (this.idleConnectionTimeout > 0L) { - if (currentTime - timestamps.lastChannelRead() > this.idleConnectionTimeout) { + if (this.idleConnectionTimeoutInNanos > 0L) { + if (currentTime - timestamps.lastChannelRead() > this.idleConnectionTimeoutInNanos) { return promise.setSuccess(Boolean.FALSE); } } @@ -187,9 +187,9 @@ static final class JsonSerializer extends StdSerializer, String> simpleClassNames = new ConcurrentHashMap<>(); private RntbdObjectMapper() { } + public static T readValue(File file, Class type) throws IOException { + checkNotNull(file, "expected non-null file"); + checkNotNull(type, "expected non-null type"); + return objectMapper.readValue(file, type); + } + + public static T readValue(InputStream stream, Class type) throws IOException { + checkNotNull(stream, "expected non-null stream"); + checkNotNull(type, "expected non-null type"); + return objectMapper.readValue(stream, type); + } + + public static T readValue(String string, Class type) throws IOException { + checkNotNull(string, "expected non-null string"); + checkNotNull(type, "expected non-null type"); + return objectMapper.readValue(string, type); + } + public static String toJson(final Object value) { try { return objectWriter.writeValueAsString(value); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java index 61123179ffe8..c952152cc728 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java @@ -159,5 +159,6 @@ public void serialize( generator.writeEndObject(); } } + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java index 0af684d857b7..5a8793e81d73 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java @@ -13,55 +13,34 @@ import java.util.Set; import java.util.concurrent.TimeUnit; -import static com.google.common.base.Strings.lenientFormat; - public final class RntbdRequestTimer implements AutoCloseable { - private static final long FIVE_MILLISECONDS = 5000000L; - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestTimer.class); - private final long requestTimeout; + private final long requestTimeoutInNanos; private final Timer timer; - public RntbdRequestTimer(final long requestTimeout) { - // Inspection of the HashWheelTimer code indicates that our choice of a 5 millisecond timer resolution ensures - // a request will expire within 10 milliseconds of the specified requestTimeout interval. This is because - // cancellation of a timeout takes two timer resolution units to complete. - this.timer = new HashedWheelTimer(FIVE_MILLISECONDS, TimeUnit.NANOSECONDS); - this.requestTimeout = requestTimeout; + public RntbdRequestTimer(final long requestTimeoutInNanos, final long requestTimerResolutionInNanos) { + // The HashWheelTimer code shows that cancellation of a timeout takes two timer resolution units to complete. + this.timer = new HashedWheelTimer(requestTimerResolutionInNanos, TimeUnit.NANOSECONDS); + this.requestTimeoutInNanos = requestTimeoutInNanos; } public long getRequestTimeout(final TimeUnit unit) { - return unit.convert(requestTimeout, TimeUnit.NANOSECONDS); + return unit.convert(requestTimeoutInNanos, TimeUnit.NANOSECONDS); } @Override public void close() { - final Set timeouts = this.timer.stop(); - final int count = timeouts.size(); - - if (count == 0) { - logger.debug("no outstanding request timeout tasks"); - return; - } - - logger.debug("stopping {} request timeout tasks", count); - - for (final Timeout timeout : timeouts) { - if (!timeout.isExpired()) { - try { - timeout.task().run(timeout); - } catch (Throwable error) { - logger.warn(lenientFormat("request timeout task failed due to ", error)); - } + if (logger.isDebugEnabled()) { + final int count = timeouts.size(); + if (count > 0) { + logger.debug("request expiration tasks cancelled: {}", count); } } - - logger.debug("{} request timeout tasks stopped", count); } public Timeout newTimeout(final TimerTask task) { - return this.timer.newTimeout(task, this.requestTimeout, TimeUnit.NANOSECONDS); + return this.timer.newTimeout(task, this.requestTimeoutInNanos, TimeUnit.NANOSECONDS); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java index e29d65468518..83283f220d98 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java @@ -317,7 +317,7 @@ public Provider(final RntbdTransportClient transportClient, final Options option checkNotNull(sslContext, "expected non-null sslContext"); final DefaultThreadFactory threadFactory = new DefaultThreadFactory("cosmos-rntbd-nio", true); - final int threadCount = 2 * Runtime.getRuntime().availableProcessors(); + final int threadCount = Runtime.getRuntime().availableProcessors(); final LogLevel wireLogLevel; if (logger.isTraceEnabled()) { @@ -330,9 +330,12 @@ public Provider(final RntbdTransportClient transportClient, final Options option this.transportClient = transportClient; this.config = new Config(options, sslContext, wireLogLevel); - this.requestTimer = new RntbdRequestTimer(config.requestTimeoutInNanos()); - this.eventLoopGroup = new NioEventLoopGroup(threadCount, threadFactory); + this.requestTimer = new RntbdRequestTimer( + config.requestTimeoutInNanos(), + config.requestTimerResolutionInNanos()); + + this.eventLoopGroup = new NioEventLoopGroup(threadCount, threadFactory); this.endpoints = new ConcurrentHashMap<>(); this.evictions = new AtomicInteger(); this.closed = new AtomicBoolean(); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java index fc318844ecbd..424f4886b779 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java @@ -172,31 +172,22 @@ public HttpHeaders headers() { @Override public Flux body() { - return bodyIntern().doFinally(s -> this.close()); + return bodyIntern(); } @Override public Mono bodyAsByteArray() { - return bodyIntern().aggregate().asByteArray().doFinally(s -> this.close()); + return bodyIntern().aggregate().asByteArray(); } @Override public Mono bodyAsString() { - return bodyIntern().aggregate().asString().doFinally(s -> this.close()); + return bodyIntern().aggregate().asString(); } @Override public Mono bodyAsString(Charset charset) { - return bodyIntern().aggregate().asString(charset).doFinally(s -> this.close()); - } - - @Override - public void close() { - if (reactorNettyConnection.channel().eventLoop().inEventLoop()) { - reactorNettyConnection.dispose(); - } else { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } + return bodyIntern().aggregate().asString(charset); } private ByteBufFlux bodyIntern() { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java index b6201b086f23..54eee4424e36 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java @@ -914,7 +914,9 @@ static class Provider implements RntbdEndpoint.Provider { Provider(RntbdTransportClient.Options options, SslContext sslContext, RntbdResponse expected) { this.config = new Config(options, sslContext, LogLevel.WARN); - this.timer = new RntbdRequestTimer(config.requestTimeoutInNanos()); + this.timer = new RntbdRequestTimer( + config.requestTimeoutInNanos(), + config.requestTimerResolutionInNanos()); this.expected = expected; } diff --git a/sdk/e2e/pom.xml b/sdk/e2e/pom.xml index 95ddeecb9233..96776d877a8f 100644 --- a/sdk/e2e/pom.xml +++ b/sdk/e2e/pom.xml @@ -23,12 +23,12 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 com.azure azure-core-http-netty - 1.2.0-beta.1 + 1.2.0 com.azure @@ -48,7 +48,7 @@ com.azure azure-security-keyvault-certificates - 4.0.0-beta.7 + 4.0.0-beta.8 org.slf4j @@ -59,7 +59,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md index fcc0d9fb4abd..56d05dd8004a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -1,4 +1,7 @@ # Release History + +## 1.0.1 (2020-01-07) + ## 1.0.0-beta.4 (2019-12-02) - Artifact name changed from `preview` to `beta`. - `BlobCheckpointStore` implementation updated to match changes in `CheckpointStore` interface. @@ -20,7 +23,7 @@ our efforts can be found in the [Azure SDK Design Guidelines for Java](https://a - Reactive streams support using [Project Reactor](https://projectreactor.io/). - Receive messages from all partitions of an Azure Event Hub using `EventProcessor`. -- Provide an instance of `BlobCheckpointStore` to your Event Processor. `BlobCheckpointStore` uses Azure Blob Storage to +- Provide an instance of `BlobCheckpointStore` to your Event Processor. `BlobCheckpointStore` uses Azure Blob Storage to store checkpoints and balance partition load among all instances of Event Processors. - Store checkpoint and partition ownership details in [Azure Storage Blobs](https://azure.microsoft.com/en-us/services/storage/blobs/). diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md index d0a55f1456a3..5f0394f62c4b 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -30,7 +30,7 @@ All client libraries, by default, use the Tomcat-native Boring SSL library to en com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.0.0-beta.4 + 1.0.1 ``` [//]: # ({x-version-update-end}) @@ -69,6 +69,7 @@ sequence number and the timestamp of when it was enqueued. ### Create an instance of Storage container with SAS token + ```java BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder() .connectionString("") @@ -91,32 +92,35 @@ In our example, we will focus on building the [`EventProcessor`][source_eventpro [`BlobCheckpointStore`][source_blobcheckpointstore], and a simple callback function to process the events received from the Event Hubs, writes to console and updates the checkpoint in Blob storage after each event. + ```java -class Program { - public static void main(String[] args) { - EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() - .consumerGroup("<< CONSUMER GROUP NAME >>") - .connectionString("<< EVENT HUB CONNECTION STRING >>") - .checkpointStore(new BlobCheckpointStore(blobContainerAsyncClient)) - .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); - }) - .processError(errorContext -> { - System.out.println("Error occurred while processing events " + errorContext.getThrowable().getMessage()); - }) - .buildEventProcessorClient(); - - // This will start the processor. It will start processing events from all partitions. - eventProcessorClient.start(); - - // (for demo purposes only - adding sleep to wait for receiving events) - TimeUnit.SECONDS.sleep(2); - - // When the user wishes to stop processing events, they can call `stop()`. - eventProcessorClient.stop(); - } -} +BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder() + .connectionString("") + .containerName("") + .sasToken("") + .buildAsyncClient(); + +EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup("<< CONSUMER GROUP NAME >>") + .connectionString("<< EVENT HUB CONNECTION STRING >>") + .checkpointStore(new BlobCheckpointStore(blobContainerAsyncClient)) + .processEvent(eventContext -> { + System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " + + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + }) + .processError(errorContext -> { + System.out.println("Error occurred while processing events " + errorContext.getThrowable().getMessage()); + }) + .buildEventProcessorClient(); + +// This will start the processor. It will start processing events from all partitions. +eventProcessorClient.start(); + +// (for demo purposes only - adding sleep to wait for receiving events) +TimeUnit.SECONDS.sleep(2); + +// When the user wishes to stop processing events, they can call `stop()`. +eventProcessorClient.stop(); ``` ## Troubleshooting diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml index d8c49d919632..496c96601eb1 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml @@ -17,7 +17,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.0.0-beta.5 + 1.0.1 Microsoft Azure client library for storing checkpoints in Storage Blobs Library for using storing checkpoints in Storage Blobs @@ -40,12 +40,12 @@ com.azure azure-messaging-eventhubs - 5.0.0-beta.7 + 5.0.1 com.azure azure-storage-blob - 12.1.0 + 12.2.0-beta.1 diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/ReadmeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/ReadmeSamples.java new file mode 100644 index 000000000000..8f5d15d5ce63 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/ReadmeSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.checkpointstore.blob; + +import com.azure.messaging.eventhubs.EventProcessorClient; +import com.azure.messaging.eventhubs.EventProcessorClientBuilder; +import com.azure.storage.blob.BlobContainerAsyncClient; +import com.azure.storage.blob.BlobContainerClientBuilder; +import java.util.concurrent.TimeUnit; + +/** + * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS ARE USED TO EXTRACT + * APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING LINE NUMBERS OF EXISTING CODE + * SAMPLES. + * + * Class containing code snippets that will be injected to README.md. + */ +public class ReadmeSamples { + + /** + * Code sample for creating an async blob container client. + */ + public void createBlobContainerClient() { + BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder() + .connectionString("") + .containerName("") + .sasToken("") + .buildAsyncClient(); + } + + /** + * Code sample for consuming events from event processor with blob checkpoint store. + * @throws InterruptedException If the thread is interrupted. + */ + public void consumeEventsUsingEventProcessor() throws InterruptedException { + BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder() + .connectionString("") + .containerName("") + .sasToken("") + .buildAsyncClient(); + + EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup("<< CONSUMER GROUP NAME >>") + .connectionString("<< EVENT HUB CONNECTION STRING >>") + .checkpointStore(new BlobCheckpointStore(blobContainerAsyncClient)) + .processEvent(eventContext -> { + System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " + + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + }) + .processError(errorContext -> { + System.out.println("Error occurred while processing events " + errorContext.getThrowable().getMessage()); + }) + .buildEventProcessorClient(); + + // This will start the processor. It will start processing events from all partitions. + eventProcessorClient.start(); + + // (for demo purposes only - adding sleep to wait for receiving events) + TimeUnit.SECONDS.sleep(2); + + // When the user wishes to stop processing events, they can call `stop()`. + eventProcessorClient.stop(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md index bbaa76fca87b..0364f66df4b7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md @@ -1,4 +1,12 @@ # Release History + +## 5.0.1 (2020-01-07) +- Add support for different error handling cases in EventProcessor. +- Recreate connection in client on transient errors. +- Add tracing links when sending a batch of events. +- Tracing link names are shortened when sending events. +- EventPosition.fromOffset(long) is no longer inclusive. + ## 5.0.0-beta.6 (2019-12-02) - Artifact name changed from `preview` to `beta`. - Producer clients (both sync and async) support sending events only using `EventDataBatch`. All other send overloads are removed. @@ -20,10 +28,10 @@ be declared at the time of receiving events and not when the client is created. - `EventHubProducerAsyncClient` and `EventHubProduderClient` for sending events. - `EventHubConsumerAsyncClient` and `EventHubConsumerClient` for receiving events. - Moved `InMemoryPartitionManager` from main package to samples and renamed to `InMemoryEventProcessorStore` -- The `EventProcessorStore`, previously `PartitionManager`, has updated APIs to include `fullyQualifiedNamespace` of +- The `EventProcessorStore`, previously `PartitionManager`, has updated APIs to include `fullyQualifiedNamespace` of the Event Hub. - Updates to `EventProcessor` to allow functional callbacks for processing events, errors etc. - + ## 5.0.0-preview.4 (2019-10-08) - Proxy support for Event Hubs sync and async clients. - `EventHubConsumer` and `EventHubAsyncConsumer` now provides last enqueued event information. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 2d18142c964d..081f4809ad84 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -60,7 +60,7 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples] com.azure azure-messaging-eventhubs - 5.0.0-beta.6 + 5.0.1 ``` [//]: # ({x-version-update-end}) @@ -90,6 +90,7 @@ consumers. The snippet below creates a synchronous Event Hub producer. + ```java String connectionString = "<< CONNECTION STRING FOR THE EVENT HUBS NAMESPACE >>"; String eventHubName = "<< NAME OF THE EVENT HUB >>"; @@ -108,7 +109,7 @@ platform. First, add the package: com.azure azure-identity - 1.0.1 + 1.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -123,6 +124,7 @@ Follow the instructions in [Creating a service principal using Azure Portal][app service principal and a client secret. The corresponding `clientId` and `tenantId` for the service principal can be obtained from the [App registration page][app_registration_page]. + ```java ClientSecretCredential credential = new ClientSecretCredentialBuilder() .clientId("<< APPLICATION (CLIENT) ID >>") @@ -139,6 +141,10 @@ EventHubProducerClient client = new EventHubClientBuilder() .buildProducerClient(); ``` +When using Azure Active Directory, your principal must be assigned a role which allows access to Event Hubs, such +as the `Azure Event Hubs Data Owner` role. For more information about using Azure Active Directory authorization +with Event Hubs, please refer to [the associated documentation][aad_authorization]. + ## Key concepts - An **Event Hub producer** is a source of telemetry data, diagnostics information, usage logs, or other log data, as @@ -188,6 +194,7 @@ Event Hubs service to hash the events and send them to the same partition. The snippet below creates a synchronous producer and sends events to any partition, allowing Event Hubs service to route the event to an available partition. + ```java EventHubProducerClient producer = new EventHubClientBuilder() .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") @@ -208,7 +215,6 @@ for (EventData eventData : allEvents) { } } } - // send the last batch of remaining events if (eventDataBatch.getCount() > 0) { producer.send(eventDataBatch); @@ -226,6 +232,7 @@ Hub, their names are assigned at the time of creation. To understand what partit using `EventHubsClientBuilder` can query for metadata about the Event Hub using `getPartitionIds()` or `getEventHubProperties()`. + ```java EventHubProducerClient producer = new EventHubClientBuilder() .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") @@ -244,7 +251,12 @@ When an Event Hub producer is not associated with any specific partition, it may Hubs service keep different events or batches of events together on the same partition. This can be accomplished by setting a `partition key` when publishing the events. + ```java +EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildProducerClient(); + CreateBatchOptions batchOptions = new CreateBatchOptions().setPartitionKey("grouping-key"); EventDataBatch eventDataBatch = producer.createBatch(batchOptions); @@ -266,6 +278,7 @@ to newest events that get pushed to the partition by invoking `receiveFromPartit can begin receiving events from multiple partitions using the same EventHubConsumerAsyncClient by calling `receiveFromPartition(String, EventPosition)` with another partition id, and subscribing to that Flux. + ```java EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") @@ -283,6 +296,7 @@ consumer.receiveFromPartition("0", EventPosition.latest()).subscribe(event -> { Developers can create a synchronous consumer that returns events in batches using an `EventHubConsumerClient`. In the snippet below, a consumer is created that starts reading events from the beginning of the partition's event stream. + ```java EventHubConsumerClient consumer = new EventHubClientBuilder() .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") @@ -313,32 +327,30 @@ In our example, we will focus on building the [`EventProcessorClient`][EventProc [`InMemoryCheckpointStore`][InMemoryCheckpointStore] available in samples, and a callback function that processes events received from the Event Hub and writes to console. + ```java -class Program { - public static void main(String[] args) { - EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() - .consumerGroup("<< CONSUMER GROUP NAME >>") - .connectionString("<< EVENT HUB CONNECTION STRING >>") - .checkpointStore(new InMemoryCheckpointStore()) - .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); - }) - .processError(errorContext -> { - System.out.println("Error occurred while processing events " + errorContext.getThrowable().getMessage()); - }) - .buildEventProcessorClient(); - - // This will start the processor. It will start processing events from all partitions. - eventProcessorClient.start(); - - // (for demo purposes only - adding sleep to wait for receiving events) - TimeUnit.SECONDS.sleep(2); - - // When the user wishes to stop processing events, they can call `stop()`. - eventProcessorClient.stop(); - } -} +EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup("<< CONSUMER GROUP NAME >>") + .connectionString("<< EVENT HUB CONNECTION STRING >>") + .checkpointStore(new InMemoryCheckpointStore()) + .processEvent(eventContext -> { + System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " + + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + }) + .processError(errorContext -> { + System.out + .println("Error occurred while processing events " + errorContext.getThrowable().getMessage()); + }) + .buildEventProcessorClient(); + +// This will start the processor. It will start processing events from all partitions. +eventProcessorClient.start(); + +// (for demo purposes only - adding sleep to wait for receiving events) +TimeUnit.SECONDS.sleep(2); + +// This will stop processing events. +eventProcessorClient.stop(); ``` ## Troubleshooting @@ -414,7 +426,6 @@ Beyond those discussed, the Azure Event Hubs client library offers support for m advantage of the full feature set of the Azure Event Hubs service. In order to help explore some of the these scenarios, the following set of sample is available [here][samples_readme]. - ## Contributing If you would like to become an active contributor to this project please refer to our [Contribution @@ -422,6 +433,7 @@ Guidelines](./CONTRIBUTING.md) for more information. [amqp_transport_error]: https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-amqp-error +[aad_authorization]: https://docs.microsoft.com/azure/event-hubs/authorize-access-azure-active-directory [api_documentation]: https://aka.ms/java-docs [app_registration_page]: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#get-values-for-signing-in [application_client_secret]: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#create-a-new-application-secret @@ -439,15 +451,6 @@ Guidelines](./CONTRIBUTING.md) for more information. [qpid_proton_j_apache]: http://qpid.apache.org/proton/ [samples_readme]: ./src/samples/README.md [sample_examples]: ./src/samples/java/com/azure/messaging/eventhubs/ -[sample_consume_event]: ./src/samples/java/com/azure/messaging/eventhubs/ConsumeEvents.java -[sample_consume_sequence_number]: ./src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java -[sample_event_processor]: ./src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java -[sample_get_event_hubs_metadata]: ./src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java -[sample_publish_custom_metadata]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java -[sample_publish_identity]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java -[sample_publish_partitionId]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java -[sample_publish_partitionKey]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java -[sample_publish_size_limited]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithSizeLimitedBatches.java [source_code]: ./ [AmqpException]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java [AmqpErrorCondition]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorCondition.java diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index 25907cddd2a7..ba370acb3b1a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -14,7 +14,7 @@ com.azure azure-messaging-eventhubs - 5.0.0-beta.7 + 5.0.1 Microsoft Azure client library for Event Hubs Libraries built on Microsoft Azure Event Hubs @@ -37,12 +37,12 @@ com.azure azure-core - 1.2.0-beta.1 + 1.2.0 com.azure azure-core-amqp - 1.0.0-beta.9 + 1.0.1 @@ -55,7 +55,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java index ac1d1366f5e2..9d7112ced1cf 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java @@ -35,6 +35,7 @@ import java.net.InetSocketAddress; import java.net.Proxy; import java.util.Locale; +import java.util.Map; import java.util.Objects; import java.util.ServiceLoader; @@ -104,6 +105,10 @@ public class EventHubClientBuilder { // Default number of events to fetch when creating the consumer. static final int DEFAULT_PREFETCH_COUNT = 500; + private static final String EVENTHUBS_PROPERTIES_FILE = "azure-messaging-eventhubs.properties"; + private static final String NAME_KEY = "name"; + private static final String VERSION_KEY = "version"; + private static final String UNKNOWN = "UNKNOWN"; private final ClientLogger logger = new ClientLogger(EventHubClientBuilder.class); @@ -454,7 +459,7 @@ EventHubAsyncClient buildAsyncClient() { } if (scheduler == null) { - scheduler = Schedulers.newElastic("event-hubs"); + scheduler = Schedulers.elastic(); } final MessageSerializer messageSerializer = new EventHubMessageSerializer(); @@ -511,11 +516,14 @@ private EventHubConnection buildConnection(MessageSerializer messageSerializer) final ReactorProvider provider = new ReactorProvider(); final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider); + Map properties = CoreUtils.getProperties(EVENTHUBS_PROPERTIES_FILE); + String product = properties.getOrDefault(NAME_KEY, UNKNOWN); + String clientVersion = properties.getOrDefault(VERSION_KEY, UNKNOWN); + final Mono connectionMono = Mono.fromCallable(() -> { final String connectionId = StringUtil.getRandomString("MF"); - return new EventHubReactorAmqpConnection(connectionId, connectionOptions, provider, handlerProvider, - tokenManagerProvider, messageSerializer); + tokenManagerProvider, messageSerializer, product, clientVersion); }); return new EventHubConnection(connectionMono, connectionOptions); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClient.java index 044c6f3de373..5f138fa8a1a5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClient.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClient.java @@ -7,19 +7,21 @@ import com.azure.core.annotation.ServiceClient; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.PartitionProcessor; +import com.azure.messaging.eventhubs.models.ErrorContext; import com.azure.messaging.eventhubs.models.EventPosition; import java.util.Locale; -import java.util.concurrent.atomic.AtomicReference; -import reactor.core.Disposable; -import reactor.core.scheduler.Scheduler; -import reactor.core.scheduler.Schedulers; - +import java.util.Map; import java.util.Objects; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; import java.util.function.Supplier; +import reactor.core.Disposable; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; /** * EventProcessorClient provides a convenient mechanism to consume events from all partitions of an Event Hub in the @@ -40,7 +42,7 @@ public class EventProcessorClient { private final ClientLogger logger = new ClientLogger(EventProcessorClient.class); private final String identifier; - private final AtomicBoolean started = new AtomicBoolean(false); + private final AtomicBoolean isRunning = new AtomicBoolean(false); private final PartitionPumpManager partitionPumpManager; private final PartitionBasedLoadBalancer partitionBasedLoadBalancer; private final CheckpointStore checkpointStore; @@ -54,33 +56,34 @@ public class EventProcessorClient { * @param eventHubClientBuilder The {@link EventHubClientBuilder}. * @param consumerGroup The consumer group name used in this event processor to consumer events. * @param partitionProcessorFactory The factory to create new partition processor(s). - * @param initialEventPosition Initial event position to start consuming events. * @param checkpointStore The store used for reading and updating partition ownership and checkpoints. information. - * @param trackLastEnqueuedEventProperties If set to {@code true}, all events received by this - * EventProcessorClient will also include the last enqueued event properties for it's respective partitions. + * @param trackLastEnqueuedEventProperties If set to {@code true}, all events received by this EventProcessorClient + * will also include the last enqueued event properties for it's respective partitions. * @param tracerProvider The tracer implementation. + * @param processError Error handler for any errors that occur outside the context of a partition. + * @param initialPartitionEventPosition Map of initial event positions for partition ids. */ EventProcessorClient(EventHubClientBuilder eventHubClientBuilder, String consumerGroup, - Supplier partitionProcessorFactory, EventPosition initialEventPosition, - CheckpointStore checkpointStore, boolean trackLastEnqueuedEventProperties, TracerProvider tracerProvider) { + Supplier partitionProcessorFactory, CheckpointStore checkpointStore, + boolean trackLastEnqueuedEventProperties, TracerProvider tracerProvider, Consumer processError, + Map initialPartitionEventPosition) { Objects.requireNonNull(eventHubClientBuilder, "eventHubClientBuilder cannot be null."); Objects.requireNonNull(consumerGroup, "consumerGroup cannot be null."); Objects.requireNonNull(partitionProcessorFactory, "partitionProcessorFactory cannot be null."); - Objects.requireNonNull(initialEventPosition, "initialEventPosition cannot be null."); this.checkpointStore = Objects.requireNonNull(checkpointStore, "checkpointStore cannot be null"); this.identifier = UUID.randomUUID().toString(); logger.info("The instance ID for this event processors is {}", this.identifier); this.partitionPumpManager = new PartitionPumpManager(checkpointStore, partitionProcessorFactory, - initialEventPosition, eventHubClientBuilder, trackLastEnqueuedEventProperties, tracerProvider); + eventHubClientBuilder, trackLastEnqueuedEventProperties, tracerProvider, initialPartitionEventPosition); EventHubAsyncClient eventHubAsyncClient = eventHubClientBuilder.buildAsyncClient(); this.partitionBasedLoadBalancer = new PartitionBasedLoadBalancer(this.checkpointStore, eventHubAsyncClient, eventHubAsyncClient.getFullyQualifiedNamespace().toLowerCase(Locale.ROOT), eventHubAsyncClient.getEventHubName().toLowerCase(Locale.ROOT), consumerGroup.toLowerCase(Locale.ROOT), identifier, TimeUnit.MINUTES.toSeconds(1), - partitionPumpManager); + partitionPumpManager, processError); } /** @@ -105,7 +108,7 @@ public String getIdentifier() { * {@codesnippet com.azure.messaging.eventhubs.eventprocessorclient.startstop} */ public synchronized void start() { - if (!started.compareAndSet(false, true)) { + if (!isRunning.compareAndSet(false, true)) { logger.info("Event processor is already running"); return; } @@ -129,7 +132,7 @@ public synchronized void start() { * {@codesnippet com.azure.messaging.eventhubs.eventprocessorclient.startstop} */ public synchronized void stop() { - if (!started.compareAndSet(true, false)) { + if (!isRunning.compareAndSet(true, false)) { logger.info("Event processor has already stopped"); return; } @@ -137,4 +140,14 @@ public synchronized void stop() { scheduler.get().dispose(); this.partitionPumpManager.stopAllPartitionPumps(); } + + /** + * Returns {@code true} if the event processor is running. If the event processor is already running, calling + * {@link #start()} has no effect. + * + * @return {@code true} if the event processor is running. + */ + public synchronized boolean isRunning() { + return isRunning.get(); + } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClientBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClientBuilder.java index aef2a3a63100..1b1d0637b8df 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClientBuilder.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorClientBuilder.java @@ -19,6 +19,8 @@ import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.ErrorContext; import com.azure.messaging.eventhubs.models.InitializationContext; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; import java.util.ServiceLoader; import java.util.function.Consumer; @@ -73,6 +75,7 @@ public class EventProcessorClientBuilder { private Consumer processPartitionInitialization; private Consumer processPartitionClose; private boolean trackLastEnqueuedEventProperties; + private Map initialPartitionEventPosition = new HashMap<>(); /** * Creates a new instance of {@link EventProcessorClientBuilder}. @@ -289,7 +292,6 @@ public EventProcessorClientBuilder processPartitionClose(Consumer * * @param trackLastEnqueuedEventProperties {@code true} if the resulting events will keep track of the last * enqueued information for that partition; {@code false} otherwise. - * * @return The updated {@link EventProcessorClientBuilder} instance. */ public EventProcessorClientBuilder trackLastEnqueuedEventProperties(boolean trackLastEnqueuedEventProperties) { @@ -297,6 +299,23 @@ public EventProcessorClientBuilder trackLastEnqueuedEventProperties(boolean trac return this; } + /** + * Sets the map containing the event position to use for each partition if a checkpoint for the partition does not + * exist in {@link CheckpointStore}. This map is keyed off of the partition id. If there is no checkpoint in + * {@link CheckpointStore} and there is no entry in this map, the processing of the partition will start from + * {@link EventPosition#latest() latest} position. + * + * @param initialPartitionEventPosition Map of initial event positions for partition ids. + * @return The updated {@link EventProcessorClientBuilder} instance. + */ + public EventProcessorClientBuilder initialPartitionEventPosition( + Map initialPartitionEventPosition) { + + this.initialPartitionEventPosition = Objects.requireNonNull(initialPartitionEventPosition, + "'initialPartitionEventPosition' cannot be null."); + return this; + } + /** * This will create a new {@link EventProcessorClient} configured with the options set in this builder. Each call to * this method will return a new instance of {@link EventProcessorClient}. @@ -321,8 +340,8 @@ public EventProcessorClient buildEventProcessorClient() { final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); return new EventProcessorClient(eventHubClientBuilder, this.consumerGroup, - getPartitionProcessorSupplier(), EventPosition.earliest(), checkpointStore, - trackLastEnqueuedEventProperties, tracerProvider); + getPartitionProcessorSupplier(), checkpointStore, trackLastEnqueuedEventProperties, tracerProvider, + processError, initialPartitionEventPosition); } private Supplier getPartitionProcessorSupplier() { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java index e72e5b932b8b..6caee9db26a7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancer.java @@ -5,7 +5,10 @@ import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.models.ErrorContext; +import com.azure.messaging.eventhubs.models.PartitionContext; import com.azure.messaging.eventhubs.models.PartitionOwnership; +import java.util.function.Consumer; import reactor.core.Exceptions; import reactor.core.publisher.Mono; import reactor.util.function.Tuple2; @@ -47,6 +50,8 @@ final class PartitionBasedLoadBalancer { private final long inactiveTimeLimitInSeconds; private final PartitionPumpManager partitionPumpManager; private final String fullyQualifiedNamespace; + private final Consumer processError; + private final PartitionContext partitionAgnosticContext; /** * Creates an instance of PartitionBasedLoadBalancer for the given Event Hub name and consumer group. @@ -60,11 +65,13 @@ final class PartitionBasedLoadBalancer { * assuming the owner of the partition is inactive. * @param partitionPumpManager The partition pump manager that keeps track of all EventHubConsumers and partitions * that this {@link EventProcessorClient} is processing. + * @param processError The callback that will be called when an error occurs while running the load balancer. */ PartitionBasedLoadBalancer(final CheckpointStore checkpointStore, final EventHubAsyncClient eventHubAsyncClient, final String fullyQualifiedNamespace, final String eventHubName, final String consumerGroupName, final String ownerId, - final long inactiveTimeLimitInSeconds, final PartitionPumpManager partitionPumpManager) { + final long inactiveTimeLimitInSeconds, final PartitionPumpManager partitionPumpManager, + final Consumer processError) { this.checkpointStore = checkpointStore; this.eventHubAsyncClient = eventHubAsyncClient; this.fullyQualifiedNamespace = fullyQualifiedNamespace; @@ -73,6 +80,9 @@ final class PartitionBasedLoadBalancer { this.ownerId = ownerId; this.inactiveTimeLimitInSeconds = inactiveTimeLimitInSeconds; this.partitionPumpManager = partitionPumpManager; + this.processError = processError; + this.partitionAgnosticContext = new PartitionContext(fullyQualifiedNamespace, eventHubName, + consumerGroupName, "NONE"); } /** @@ -107,8 +117,12 @@ void loadBalance() { Mono.zip(partitionOwnershipMono, partitionsMono) .flatMap(this::loadBalance) // if there was an error, log warning and TODO: call user provided error handler - .doOnError(ex -> logger.warning(Messages.LOAD_BALANCING_FAILED, ex.getMessage())) - .subscribe(); + .subscribe(ignored -> { }, + ex -> { + logger.warning(Messages.LOAD_BALANCING_FAILED, ex.getMessage()); + ErrorContext errorContext = new ErrorContext(partitionAgnosticContext, ex); + processError.accept(errorContext); + }, () -> logger.info("Load balancing completed successfully")); } /* @@ -193,7 +207,11 @@ private Mono loadBalance(final Tuple2, Lis // If the partitions are evenly distributed among all active event processors, no change required. logger.info("Load is balanced"); // renew ownership of already owned partitions - checkpointStore.claimOwnership(ownerPartitionMap.get(this.ownerId)).subscribe(); + checkpointStore.claimOwnership(partitionPumpManager.getPartitionPumps().keySet() + .stream() + .map(partitionId -> createPartitionOwnershipRequest(partitionOwnershipMap, partitionId)) + .collect(Collectors.toList())) + .subscribe(); return; } @@ -202,7 +220,11 @@ private Mono loadBalance(final Tuple2, Lis logger.info("This event processor owns {} partitions and shouldn't own more", ownerPartitionMap.get(ownerId).size()); // renew ownership of already owned partitions - checkpointStore.claimOwnership(ownerPartitionMap.get(this.ownerId)).subscribe(); + checkpointStore.claimOwnership(partitionPumpManager.getPartitionPumps().keySet() + .stream() + .map(partitionId -> createPartitionOwnershipRequest(partitionOwnershipMap, partitionId)) + .collect(Collectors.toList())) + .subscribe(); return; } @@ -331,11 +353,16 @@ private void claimOwnership(final Map partitionOwner PartitionOwnership ownershipRequest = createPartitionOwnershipRequest(partitionOwnershipMap, partitionIdToClaim); - List currentPartitionsOwned = ownerPartitionsMap.get(ownerId); - currentPartitionsOwned.add(ownershipRequest); + List partitionsToClaim = new ArrayList<>(); + partitionsToClaim.add(ownershipRequest); + partitionsToClaim.addAll(partitionPumpManager.getPartitionPumps() + .keySet() + .stream() + .map(partitionId -> createPartitionOwnershipRequest(partitionOwnershipMap, partitionId)) + .collect(Collectors.toList())); checkpointStore - .claimOwnership(currentPartitionsOwned) + .claimOwnership(partitionsToClaim) .timeout(Duration.ofMinutes(1)) // TODO: configurable .doOnNext(partitionOwnership -> logger.info("Successfully claimed ownership of partition {}", partitionOwnership.getPartitionId())) @@ -350,7 +377,10 @@ private void claimOwnership(final Map partitionOwner .stream() .forEach(po -> partitionPumpManager.startPartitionPump(po, ownedPartitionCheckpointsTuple.getT2().get(po.getPartitionId()))); - }); + }, + ex -> { + throw logger.logExceptionAsError(new RuntimeException("Error while listing checkpoints", ex)); + }); } private PartitionOwnership createPartitionOwnershipRequest( diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java index 451485fd573b..6694fd6741f4 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java @@ -3,24 +3,29 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.exception.AmqpException; +import static com.azure.core.util.tracing.Tracer.DIAGNOSTIC_ID_KEY; +import static com.azure.core.util.tracing.Tracer.SCOPE_KEY; +import static com.azure.core.util.tracing.Tracer.SPAN_CONTEXT_KEY; +import static com.azure.core.util.tracing.Tracer.ENTITY_PATH_KEY; +import static com.azure.core.util.tracing.Tracer.HOST_NAME_KEY; + import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.tracing.ProcessKind; import com.azure.messaging.eventhubs.implementation.PartitionProcessor; +import com.azure.messaging.eventhubs.implementation.PartitionProcessorException; import com.azure.messaging.eventhubs.models.Checkpoint; import com.azure.messaging.eventhubs.models.CloseContext; import com.azure.messaging.eventhubs.models.CloseReason; +import com.azure.messaging.eventhubs.models.ErrorContext; import com.azure.messaging.eventhubs.models.EventContext; import com.azure.messaging.eventhubs.models.EventPosition; -import com.azure.messaging.eventhubs.models.ErrorContext; import com.azure.messaging.eventhubs.models.InitializationContext; import com.azure.messaging.eventhubs.models.PartitionContext; +import com.azure.messaging.eventhubs.models.PartitionEvent; import com.azure.messaging.eventhubs.models.PartitionOwnership; import com.azure.messaging.eventhubs.models.ReceiveOptions; -import reactor.core.publisher.Signal; - import java.io.Closeable; import java.io.IOException; import java.util.Locale; @@ -28,12 +33,7 @@ import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; - -import static com.azure.core.util.tracing.Tracer.DIAGNOSTIC_ID_KEY; -import static com.azure.core.util.tracing.Tracer.ENTITY_PATH_KEY; -import static com.azure.core.util.tracing.Tracer.HOST_NAME_KEY; -import static com.azure.core.util.tracing.Tracer.SCOPE_KEY; -import static com.azure.core.util.tracing.Tracer.SPAN_CONTEXT_KEY; +import reactor.core.publisher.Signal; /** * The partition pump manager that keeps track of all the partition pumps started by this {@link EventProcessorClient}. @@ -52,10 +52,10 @@ class PartitionPumpManager { private final CheckpointStore checkpointStore; private final Map partitionPumps = new ConcurrentHashMap<>(); private final Supplier partitionProcessorFactory; - private final EventPosition initialEventPosition; private final EventHubClientBuilder eventHubClientBuilder; private final TracerProvider tracerProvider; private final boolean trackLastEnqueuedEventProperties; + private final Map initialPartitionEventPosition; /** * Creates an instance of partition pump manager. @@ -63,24 +63,23 @@ class PartitionPumpManager { * @param checkpointStore The partition manager that is used to store and update checkpoints. * @param partitionProcessorFactory The partition processor factory that is used to create new instances of {@link * PartitionProcessor} when new partition pumps are started. - * @param initialEventPosition The initial event position to use when a new partition pump is created and no - * checkpoint for the partition is available. * @param eventHubClientBuilder The client builder used to create new clients (and new connections) for each * partition processed by this {@link EventProcessorClient}. - * @param trackLastEnqueuedEventProperties If set to {@code true}, all events received by this - * EventProcessorClient will also include the last enqueued event properties for it's respective partitions. + * @param trackLastEnqueuedEventProperties If set to {@code true}, all events received by this EventProcessorClient + * will also include the last enqueued event properties for it's respective partitions. * @param tracerProvider The tracer implementation. + * @param initialPartitionEventPosition Map of initial event positions for partition ids. */ PartitionPumpManager(CheckpointStore checkpointStore, - Supplier partitionProcessorFactory, EventPosition initialEventPosition, - EventHubClientBuilder eventHubClientBuilder, boolean trackLastEnqueuedEventProperties, - TracerProvider tracerProvider) { + Supplier partitionProcessorFactory, EventHubClientBuilder eventHubClientBuilder, + boolean trackLastEnqueuedEventProperties, TracerProvider tracerProvider, + Map initialPartitionEventPosition) { this.checkpointStore = checkpointStore; this.partitionProcessorFactory = partitionProcessorFactory; - this.initialEventPosition = initialEventPosition; this.eventHubClientBuilder = eventHubClientBuilder; this.trackLastEnqueuedEventProperties = trackLastEnqueuedEventProperties; this.tracerProvider = tracerProvider; + this.initialPartitionEventPosition = initialPartitionEventPosition; } /** @@ -111,93 +110,112 @@ void startPartitionPump(PartitionOwnership claimedOwnership, Checkpoint checkpoi return; } - PartitionContext partitionContext = new PartitionContext(claimedOwnership.getFullyQualifiedNamespace(), - claimedOwnership.getEventHubName(), claimedOwnership.getConsumerGroup(), - claimedOwnership.getPartitionId()); - PartitionProcessor partitionProcessor = this.partitionProcessorFactory.get(); + try { + PartitionContext partitionContext = new PartitionContext(claimedOwnership.getFullyQualifiedNamespace(), + claimedOwnership.getEventHubName(), claimedOwnership.getConsumerGroup(), + claimedOwnership.getPartitionId()); + PartitionProcessor partitionProcessor = this.partitionProcessorFactory.get(); - InitializationContext initializationContext = new InitializationContext(partitionContext, - EventPosition.earliest()); - partitionProcessor.initialize(initializationContext); + InitializationContext initializationContext = new InitializationContext(partitionContext); + partitionProcessor.initialize(initializationContext); - EventPosition startFromEventPosition = null; - if (checkpoint != null && checkpoint.getOffset() != null) { - startFromEventPosition = EventPosition.fromOffset(checkpoint.getOffset()); - } else if (checkpoint != null && checkpoint.getSequenceNumber() != null) { - startFromEventPosition = EventPosition.fromSequenceNumber(checkpoint.getSequenceNumber(), true); - } else { - startFromEventPosition = initialEventPosition; + EventPosition startFromEventPosition = null; + // A checkpoint indicates the last known successfully processed event. + // So, the event position to start a new partition processing should be exclusive of the + // offset/sequence number in the checkpoint. If no checkpoint is available, start from + // the position in set in the InitializationContext (either the earliest event in the partition or + // the user provided initial position) + if (checkpoint != null && checkpoint.getOffset() != null) { + startFromEventPosition = EventPosition.fromOffset(checkpoint.getOffset()); + } else if (checkpoint != null && checkpoint.getSequenceNumber() != null) { + startFromEventPosition = EventPosition.fromSequenceNumber(checkpoint.getSequenceNumber()); + } else if (initialPartitionEventPosition.containsKey(claimedOwnership.getPartitionId())) { + startFromEventPosition = initialPartitionEventPosition.get(claimedOwnership.getPartitionId()); + } else { + startFromEventPosition = EventPosition.latest(); + } + + ReceiveOptions receiveOptions = new ReceiveOptions().setOwnerLevel(0L) + .setTrackLastEnqueuedEventProperties(trackLastEnqueuedEventProperties); + + EventHubConsumerAsyncClient eventHubConsumer = eventHubClientBuilder.buildAsyncClient() + .createConsumer(claimedOwnership.getConsumerGroup(), EventHubClientBuilder.DEFAULT_PREFETCH_COUNT); + + partitionPumps.put(claimedOwnership.getPartitionId(), eventHubConsumer); + eventHubConsumer + .receiveFromPartition(claimedOwnership.getPartitionId(), startFromEventPosition, receiveOptions) + .subscribe(partitionEvent -> processEvent(partitionContext, partitionProcessor, eventHubConsumer, + partitionEvent), + /* EventHubConsumer receive() returned an error */ + ex -> handleError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), + () -> partitionProcessor.close(new CloseContext(partitionContext, + CloseReason.EVENT_PROCESSOR_SHUTDOWN))); + } catch (Exception ex) { + if (partitionPumps.containsKey(claimedOwnership.getPartitionId())) { + cleanup(claimedOwnership, partitionPumps.get(claimedOwnership.getPartitionId())); + } + throw logger.logExceptionAsError( + new PartitionProcessorException( + "Error occurred while starting partition pump for partition " + claimedOwnership.getPartitionId(), + ex)); } - ReceiveOptions receiveOptions = new ReceiveOptions().setOwnerLevel(0L) - .setTrackLastEnqueuedEventProperties(trackLastEnqueuedEventProperties); - - EventHubConsumerAsyncClient eventHubConsumer = eventHubClientBuilder.buildAsyncClient() - .createConsumer(claimedOwnership.getConsumerGroup(), EventHubClientBuilder.DEFAULT_PREFETCH_COUNT); - - partitionPumps.put(claimedOwnership.getPartitionId(), eventHubConsumer); - - // The indentation required by checkstyle is different from the indentation IntelliJ uses. - // @formatter:off - eventHubConsumer.receiveFromPartition(claimedOwnership.getPartitionId(), startFromEventPosition, receiveOptions) - .subscribe(partitionEvent -> { - EventData eventData = partitionEvent.getData(); - Context processSpanContext = startProcessTracingSpan(eventData, eventHubConsumer.getEventHubName(), - eventHubConsumer.getFullyQualifiedNamespace()); - if (processSpanContext.getData(SPAN_CONTEXT_KEY).isPresent()) { - eventData.addContext(SPAN_CONTEXT_KEY, processSpanContext); - } - try { - partitionProcessor.processEvent(new EventContext(partitionContext, eventData, checkpointStore, - partitionEvent.getLastEnqueuedEventProperties())); - endProcessTracingSpan(processSpanContext, Signal.complete()); - } catch (Exception ex) { - /* event processing threw an exception */ - handleProcessingError(claimedOwnership, partitionProcessor, ex, partitionContext); - endProcessTracingSpan(processSpanContext, Signal.error(ex)); - - } - }, /* EventHubConsumer receive() returned an error */ - ex -> handleReceiveError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), - () -> partitionProcessor.close(new CloseContext(partitionContext, - CloseReason.EVENT_PROCESSOR_SHUTDOWN))); - // @formatter:on } - private void handleProcessingError(PartitionOwnership claimedOwnership, PartitionProcessor partitionProcessor, - Throwable error, PartitionContext partitionContext) { + private void processEvent(PartitionContext partitionContext, PartitionProcessor partitionProcessor, + EventHubConsumerAsyncClient eventHubConsumer, PartitionEvent partitionEvent) { + EventData eventData = partitionEvent.getData(); + Context processSpanContext = startProcessTracingSpan(eventData, eventHubConsumer.getEventHubName(), + eventHubConsumer.getFullyQualifiedNamespace()); + if (processSpanContext.getData(SPAN_CONTEXT_KEY).isPresent()) { + eventData.addContext(SPAN_CONTEXT_KEY, processSpanContext); + } try { - // There was an error in process event (user provided code), call process error and if that - // also fails just log and continue - partitionProcessor.processError(new ErrorContext(partitionContext, error)); - } catch (Exception ex) { - logger.warning(Messages.FAILED_WHILE_PROCESSING_ERROR, claimedOwnership.getPartitionId(), ex); + partitionProcessor.processEvent(new EventContext(partitionContext, eventData, checkpointStore, + partitionEvent.getLastEnqueuedEventProperties())); + endProcessTracingSpan(processSpanContext, Signal.complete()); + } catch (Throwable throwable) { + /* user code for event processing threw an exception - log and bubble up */ + endProcessTracingSpan(processSpanContext, Signal.error(throwable)); + throw logger.logExceptionAsError(new PartitionProcessorException("Error in event processing callback", + throwable)); } } - private void handleReceiveError(PartitionOwnership claimedOwnership, EventHubConsumerAsyncClient eventHubConsumer, - PartitionProcessor partitionProcessor, Throwable error, PartitionContext partitionContext) { + Map getPartitionPumps() { + return this.partitionPumps; + } + + private void handleError(PartitionOwnership claimedOwnership, EventHubConsumerAsyncClient eventHubConsumer, + PartitionProcessor partitionProcessor, Throwable throwable, PartitionContext partitionContext) { + boolean shouldRethrow = true; + if (!(throwable instanceof PartitionProcessorException)) { + shouldRethrow = false; + // If user code threw an exception in processEvent callback, bubble up the exception + logger.warning("Error receiving events from partition {}", partitionContext.getPartitionId(), throwable); + partitionProcessor.processError(new ErrorContext(partitionContext, throwable)); + } + // If there was an error on receive, it also marks the end of the event data stream + // Any exception while receiving events will result in the processor losing ownership + CloseReason closeReason = CloseReason.LOST_PARTITION_OWNERSHIP; + partitionProcessor.close(new CloseContext(partitionContext, closeReason)); + cleanup(claimedOwnership, eventHubConsumer); + if (shouldRethrow) { + PartitionProcessorException exception = (PartitionProcessorException) throwable; + throw logger.logExceptionAsError(exception); + } + } + + private void cleanup(PartitionOwnership claimedOwnership, EventHubConsumerAsyncClient eventHubConsumer) { try { - // if there was an error on receive, it also marks the end of the event data stream - partitionProcessor.processError(new ErrorContext(partitionContext, error)); - CloseReason closeReason = CloseReason.EVENT_HUB_EXCEPTION; - // If the exception indicates that the partition was stolen (i.e some other consumer with same ownerlevel - // started consuming the partition), update the closeReason - // TODO: Find right exception type to determine stolen partition - if (error instanceof AmqpException) { - closeReason = CloseReason.LOST_PARTITION_OWNERSHIP; - } - partitionProcessor.close(new CloseContext(partitionContext, closeReason)); - } catch (Exception ex) { - logger.warning(Messages.FAILED_PROCESSING_ERROR_RECEIVE, claimedOwnership.getPartitionId(), ex); + // close the consumer + logger.info("Closing consumer for partition id {}", claimedOwnership.getPartitionId()); + eventHubConsumer.close(); } finally { - try { - // close the consumer - eventHubConsumer.close(); - } finally { - // finally, remove the partition from partitionPumps map - partitionPumps.remove(claimedOwnership.getPartitionId()); - } + // finally, remove the partition from partitionPumps map + logger.info("Removing partition id {} from list of processing partitions", + claimedOwnership.getPartitionId()); + partitionPumps.remove(claimedOwnership.getPartitionId()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubReactorAmqpConnection.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubReactorAmqpConnection.java index 10cafdd474a6..f02043178245 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubReactorAmqpConnection.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubReactorAmqpConnection.java @@ -42,10 +42,12 @@ public class EventHubReactorAmqpConnection extends ReactorConnection implements * @param messageSerializer Serializes and deserializes proton-j messages. */ public EventHubReactorAmqpConnection(String connectionId, ConnectionOptions connectionOptions, - ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, - TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer) { + ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, + TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer, + String product, String clientVersion) { + super(connectionId, connectionOptions, reactorProvider, handlerProvider, tokenManagerProvider, - messageSerializer); + messageSerializer, product, clientVersion); this.reactorProvider = reactorProvider; this.handlerProvider = handlerProvider; this.tokenManagerProvider = tokenManagerProvider; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionProcessorException.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionProcessorException.java new file mode 100644 index 000000000000..2b2f13b00fb0 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionProcessorException.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import com.azure.core.exception.AzureException; + +/** + * Exception to wrap around the exception that was thrown from user's process event callback. + */ +public class PartitionProcessorException extends AzureException { + private static final long serialVersionUID = 6842246662817290407L; + + /** + * Creates and instance of this exception with the given message. + * @param message The error message. + */ + public PartitionProcessorException(String message) { + super(message); + } + + /** + * Creates an instance of this exception with the given message and cause. + * @param message The error message. + * @param cause The underlying cause for this exception. + */ + public PartitionProcessorException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/CloseReason.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/CloseReason.java index 09d591745b9a..0d5a39622330 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/CloseReason.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/CloseReason.java @@ -21,10 +21,4 @@ public enum CloseReason { * PartitionProcessor#close(CloseContext)} will be called with this reason. */ EVENT_PROCESSOR_SHUTDOWN, - - /** - * If a non-retryable exception occured when receiving events from Event Hub, this reason will be provided when - * {@link PartitionProcessor#close(CloseContext)} is called. - */ - EVENT_HUB_EXCEPTION } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java index b4567ca5e821..982f4c282cb8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java @@ -84,7 +84,8 @@ public static EventPosition fromEnqueuedTime(Instant enqueuedDateTime) { } /** - * Corresponds to the event in the partition at the provided offset, inclusive of that event. + * Creates a position to an event in the partition at the provided offset. The event at that offset will not be + * included. Instead, the next event is returned. * *

* The offset is the relative position for event in the context of the stream. The offset should not be considered a @@ -96,7 +97,7 @@ public static EventPosition fromEnqueuedTime(Instant enqueuedDateTime) { * @return An {@link EventPosition} object. */ public static EventPosition fromOffset(long offset) { - return fromOffset(offset, true); + return fromOffset(offset, false); } /** diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/InitializationContext.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/InitializationContext.java index b7171ed26634..91ea189e1050 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/InitializationContext.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/InitializationContext.java @@ -3,7 +3,6 @@ package com.azure.messaging.eventhubs.models; -import com.azure.messaging.eventhubs.CheckpointStore; import com.azure.messaging.eventhubs.EventProcessorClient; import com.azure.messaging.eventhubs.EventProcessorClientBuilder; import java.util.Objects; @@ -17,19 +16,15 @@ public class InitializationContext { private final PartitionContext partitionContext; - private EventPosition initialPosition; /** * Creates an instance of InitializationContext for the partition provided in the {@link PartitionContext}. * * @param partitionContext The partition information for which the event processing is going to start. - * @param initialPosition The default initial event position from which the processing will start in the absence of - * a checkpoint in {@link CheckpointStore}. * @throws NullPointerException if {@code partitionContext} or {@code initialPosition}is {@code null}. */ - public InitializationContext(final PartitionContext partitionContext, final EventPosition initialPosition) { + public InitializationContext(final PartitionContext partitionContext) { this.partitionContext = Objects.requireNonNull(partitionContext, "'partitionContext' cannot be null"); - this.initialPosition = Objects.requireNonNull(initialPosition, "'initialPosition' cannot be null"); } /** @@ -40,27 +35,4 @@ public InitializationContext(final PartitionContext partitionContext, final Even public PartitionContext getPartitionContext() { return partitionContext; } - - /** - * Returns the default initial event position from which the processing will start in the absence of a checkpoint in - * {@link CheckpointStore}. - * - * @return The default initial event position from which the processing will start in the absence of a checkpoint in - * {@link CheckpointStore}. - */ - public EventPosition getInitialPosition() { - return initialPosition; - } - - /** - * If a different initial position is desirable for this partition, setting the initial position will start the - * event processing from this position. Note that the checkpoint in {@link CheckpointStore} is given the highest - * priority and if there's a checkpoint in the store, that will be used regardless of what is set in this method. - * - * @param initialPosition The initial event position to start the event processing from. - * @throws NullPointerException if {@code initialPosition} is {@code null}. - */ - public void setInitialPosition(final EventPosition initialPosition) { - this.initialPosition = Objects.requireNonNull(initialPosition, "'initialPosition' cannot be null"); - } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/resources/azure-messaging-eventhubs.properties b/sdk/eventhubs/azure-messaging-eventhubs/src/main/resources/azure-messaging-eventhubs.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/resources/azure-messaging-eventhubs.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/README.md b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/README.md index e4149dc57766..0ca1fcc678c1 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/README.md @@ -9,6 +9,16 @@ Key concepts are explained in detail [here][sdk_readme_key_concepts]. ## Getting started Please refer to the [Getting Started][sdk_readme_getting_started] section. +### Obtaining an Event Hub instance connection string + +All the samples authorize with an Event Hub using a connection string generated for that Event Hub. The connection +string value can be obtained by: + +1. Going to your Event Hubs namespace in Azure Portal. +1. Creating an Event Hub instance. +1. Creating a "Shared access policy" for your Event Hub instance. +1. Copying the connection string from the policy's properties. + ## Examples - [Inspect Event Hub and partition properties][sample_get_event_hubs_metadata] @@ -16,10 +26,15 @@ Please refer to the [Getting Started][sdk_readme_getting_started] section. - [Publish events to a specific Event Hub partition with partition identifier][sample_publish_partitionId] - [Publish events to a specific Event Hub partition with partition key][sample_publish_partitionKey] - [Publish events to an Event Hub with a size-limited batch][sample_publish_size_limited] +- [Publish events using web sockets and a proxy][sample_publish_web_sockets_proxy] - [Publish events with custom metadata][sample_publish_custom_metadata] +- [Publish stream of events][sample_publish_stream_events] - [Consume events from an Event Hub partition][sample_consume_event] -- [Consume events starting from an event sequence number][sample_consume_sequence_number] - [Consume events from all partitions using EventProcessorClient][sample_event_processor] +- [Consume events from all partitions and manage state of processed events][sample_event_processor_state_management] +- [Consume events from all partitions and manage state of events using + EventProcessorClient][sample_event_processor_aggregate_state_management] +- [Consume events starting from an event sequence number][sample_consume_sequence_number] ## Troubleshooting See [Troubleshooting][sdk_readme_troubleshooting]. @@ -39,12 +54,16 @@ Guidelines](../../CONTRIBUTING.md) for more information. [sdk_readme_next_steps]: ../../README.md#next-steps [sample_consume_event]: ./java/com/azure/messaging/eventhubs/ConsumeEvents.java [sample_consume_sequence_number]: ./java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java -[sample_event_processor]: ./java/com/azure/messaging/eventhubs/EventProcessorSample.java +[sample_event_processor]: ./java/com/azure/messaging/eventhubs/EventProcessorClientSample.java +[sample_event_processor_aggregate_state_management]: ./java/com/azure/messaging/eventhubs/EventProcessorClientAggregateEventsSample.java +[sample_event_processor_state_management]: ./java/com/azure/messaging/eventhubs/EventProcessorClientStateManagement.java [sample_get_event_hubs_metadata]: ./java/com/azure/messaging/eventhubs/GetEventHubMetadata.java [sample_publish_custom_metadata]: ./java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java [sample_publish_identity]: ./java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java [sample_publish_partitionId]: ./java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java [sample_publish_partitionKey]: ./java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java [sample_publish_size_limited]: ./java/com/azure/messaging/eventhubs/PublishEventsWithSizeLimitedBatches.java +[sample_publish_stream_events]: ./java/com/azure/messaging/eventhubs/PublishStreamOfEvents.java +[sample_publish_web_sockets_proxy]: ./java/com/azure/messaging/eventhubs/PublishEventsWithWebSocketsAndProxy.java ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Feventhubs%2Fazure-messaging-eventhubs%2Fsrc%2Fsamples%2README.png) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvents.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvents.java index f89dcab19dfb..17f2a39efa38 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvents.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvents.java @@ -3,6 +3,7 @@ package com.azure.messaging.eventhubs; import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.PartitionContext; import com.azure.messaging.eventhubs.models.SendOptions; import reactor.core.Disposable; import reactor.core.publisher.Flux; @@ -24,8 +25,8 @@ public class ConsumeEvents { * Main method to invoke this demo about how to receive events from an Azure Event Hub instance. * * @param args Unused arguments to the program. - * @throws InterruptedException The countdown latch was interrupted while waiting for this sample to - * complete. + * + * @throws InterruptedException The countdown latch was interrupted while waiting for this sample to complete. */ public static void main(String[] args) throws InterruptedException { CountDownLatch countDownLatch = new CountDownLatch(NUMBER_OF_EVENTS); @@ -35,8 +36,8 @@ public static void main(String[] args) throws InterruptedException { // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. // Create a consumer. // The "$Default" consumer group is created by default. This value can be found by going to the Event Hub @@ -63,12 +64,25 @@ public static void main(String[] args) throws InterruptedException { Disposable subscription = consumer.receiveFromPartition(firstPartition, EventPosition.latest()) .subscribe(partitionEvent -> { EventData event = partitionEvent.getData(); + PartitionContext partitionContext = partitionEvent.getPartitionContext(); + String contents = new String(event.getBody(), UTF_8); - System.out.println(String.format("[%s] Sequence Number: %s. Contents: %s", countDownLatch.getCount(), - event.getSequenceNumber(), contents)); + System.out.printf("[#%s] Partition id: %s. Sequence Number: %s. Contents: '%s'%n", + countDownLatch.getCount(), partitionContext.getPartitionId(), event.getSequenceNumber(), + contents); countDownLatch.countDown(); - }); + }, + error -> { + System.err.println("Error occurred while consuming events: " + error); + + // Count down until 0, so the main thread does not keep waiting for events. + while (countDownLatch.getCount() > 0) { + countDownLatch.countDown(); + } + }, () -> { + System.out.println("Finished reading events."); + }); EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString(connectionString) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientAggregateEventsSample.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientAggregateEventsSample.java new file mode 100644 index 000000000000..c7d6a6e5e099 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientAggregateEventsSample.java @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.CloseContext; +import com.azure.messaging.eventhubs.models.CreateBatchOptions; +import com.azure.messaging.eventhubs.models.ErrorContext; +import com.azure.messaging.eventhubs.models.EventContext; +import com.azure.messaging.eventhubs.models.InitializationContext; +import com.azure.messaging.eventhubs.models.PartitionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.ConnectableFlux; +import reactor.core.publisher.DirectProcessor; +import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxSink; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; + +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +/** + * Demonstrates state management while processing events with {@link EventProcessorClient}. Shows usage of + * {@link EventProcessorClientBuilder#processPartitionInitialization(Consumer)}, + * {@link EventProcessorClientBuilder#processError(Consumer)}, + * {@link EventProcessorClientBuilder#processEvent(Consumer)}, and + * {@link EventProcessorClientBuilder#processPartitionClose(Consumer)}. + * + * An in-memory {@link CheckpointStore} is used to store checkpoint information for the sake of this demo. Production + * environments should leverage a durable store. + * + * A manufacturer has several machines on their assembly lines that emit temperature data. The manufacturer can use + * {@link EventProcessorClient} to aggregate the temperature data to look for anomalies. For example, the temperature + * data can say if a machine is over heating, or if no temperature data for a machine has been collected for a while, it + * may be offline. + * + * The partition key for each produced event is the name of the machine. This ensures that the temperature data for that + * machine always gets routed to the same partition. The contents of each event is the temperature of that machine in + * Celsius. + * + * Every 5 seconds, {@link MachineInformation} reports the current average temperature of the machine. + */ +public class EventProcessorClientAggregateEventsSample { + private static final Duration REPORTING_INTERVAL = Duration.ofSeconds(5); + private static final String EH_CONNECTION_STRING = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + /** + * Main method to demonstrate starting and stopping a {@link EventProcessorClient}. + * + * @param args The input arguments to this executable. + * @throws Exception If there are any errors while running the {@link EventProcessorClient}. + */ + public static void main(String[] args) throws Exception { + final MachineEventsProcessor aggregator = new MachineEventsProcessor(REPORTING_INTERVAL); + + final EventProcessorClient client = new EventProcessorClientBuilder() + .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME) + .connectionString(EH_CONNECTION_STRING) + .processPartitionInitialization(context -> aggregator.onInitialize(context)) + .processPartitionClose(context -> aggregator.onClose(context)) + .processEvent(event -> aggregator.onEvent(event)) + .processError(error -> aggregator.onError(error)) + .checkpointStore(new InMemoryCheckpointStore()) + .buildEventProcessorClient(); + + System.out.println("Starting event processor"); + final AtomicBoolean isRunning = new AtomicBoolean(true); + client.start(); + + // Continue to perform other tasks while the processor is running in the background. In this sample, we are + // randomly generating fake machine events. + generateEvents(isRunning).subscribe(); + + System.out.println("Sleeping..."); + Thread.sleep(TimeUnit.SECONDS.toMillis(30)); + isRunning.set(false); + + System.out.println("Stopping event processor"); + client.stop(); + System.out.println("Exiting process"); + } + + /** + * Helper method that generates events for machines "2A", "9B", and "6C" and sends them to the service. + */ + private static Mono generateEvents(AtomicBoolean isRunning) { + final Logger logger = LoggerFactory.getLogger("Producer"); + final Scheduler scheduler = Schedulers.elastic(); + final Duration operationTimeout = Duration.ofSeconds(5); + final String[] machineIds = new String[]{"2A", "9B", "6C"}; + final Random random = new Random(); + final EventHubProducerAsyncClient client = new EventHubClientBuilder() + .connectionString(EH_CONNECTION_STRING) + .buildAsyncProducerClient(); + + return Mono.fromRunnable(() -> { + while (isRunning.get()) { + int milliseconds = random.nextInt(1000); + + try { + TimeUnit.MILLISECONDS.sleep(milliseconds); + } catch (InterruptedException ignored) { + } + + final String machineId = machineIds[random.nextInt(machineIds.length)]; + // We want a temperature between 0 - 100. + final int temperature = Math.abs(random.nextInt() % 101); + + logger.info("[{}] Temperature: {}C", machineId, temperature); + + final EventData event = new EventData(String.valueOf(temperature)); + final CreateBatchOptions batchOptions = new CreateBatchOptions().setPartitionKey(machineId); + + client.createBatch(batchOptions).flatMap(batch -> { + batch.tryAdd(event); + return client.send(batch); + }).block(operationTimeout); + } + }).subscribeOn(scheduler) + .doFinally(signal -> { + logger.info("Disposing of producer."); + client.close(); + }); + } +} + +/** + * Keeps track of machine information by analyzing data in Event Hubs. + */ +class MachineEventsProcessor implements AutoCloseable { + private final Logger logger = LoggerFactory.getLogger(EventProcessorClientSample.class); + private final AtomicBoolean isDisposed = new AtomicBoolean(); + private final Duration reportingInterval; + + /** + * Holds information about what machines this instance is processing temperature data for. + * Key: Machine id. + * Value: Temperature information for that machine. + */ + private final ConcurrentHashMap machineInformation = new ConcurrentHashMap<>(); + /** + * Holds information about what partitions this instance is processing and its associated machines. + * Key: Partition id. + * Value: List of machine ids in that partition. + */ + private final ConcurrentHashMap> partitionsProcessing = new ConcurrentHashMap<>(); + + /** + * Creates an instance of {@link MachineEventsProcessor}. + * + * @param reportingInterval Interval at which to report temperature events. + */ + MachineEventsProcessor(Duration reportingInterval) { + this.reportingInterval = reportingInterval; + } + + /** + * Processes each event by extracting temperature and machine information from the event. + * + * @param eventContext The event received from Event Hubs. + */ + void onEvent(EventContext eventContext) { + final PartitionContext partitionContext = eventContext.getPartitionContext(); + final EventData event = eventContext.getEventData(); + final String contents = event.getBodyAsString(); + final int temperature; + try { + temperature = Integer.parseInt(contents); + } catch (NumberFormatException ex) { + logger.warn("Unable to parse temperature data. Partition: #{}. Seq #{}. Contents: #{}. Error: {}", + partitionContext.getPartitionId(), event.getSequenceNumber(), contents, ex); + return; + } + + final String machineId = event.getPartitionKey(); + if (machineId == null || machineId.isEmpty()) { + logger.warn("PartitionKey is not set on event. Partition: #{}. Seq #{}. Contents: #{}.", + partitionContext.getPartitionId(), event.getSequenceNumber(), contents); + return; + } + + partitionsProcessing.compute(partitionContext.getPartitionId(), (key, value) -> { + if (value == null) { + value = new HashSet<>(); + } + value.add(machineId); + return value; + }); + + final MachineInformation information = machineInformation.computeIfAbsent(machineId, + key -> new MachineInformation(key, reportingInterval)); + + information.onTemperatureEvent(event.getEnqueuedTime(), temperature); + + // Update checkpoint so customers know + eventContext.updateCheckpoint(); + } + + /** + * On initialisation, keeps track of which partitions it is processing. + * + * @param initializationContext Initialisation information. + */ + void onInitialize(InitializationContext initializationContext) { + final PartitionContext partition = initializationContext.getPartitionContext(); + partitionsProcessing.computeIfAbsent(partition.getPartitionId(), key -> new HashSet<>()); + } + + /** + * When an occurs, reports that error to a log. + * + * @param errorContext Error that occurred while processing events. + */ + void onError(ErrorContext errorContext) { + final PartitionContext partition = errorContext.getPartitionContext(); + + logger.error("Error occurred processing partition '{}'? {}", partition.getPartitionId(), + errorContext.getThrowable()); + } + + /** + * When a partition is lost, will dispose of machine information it is processing. In a real service, it might + * persist the averages it currently has, so there is no processed data lost. + * + * @param closeContext Close context for that partition. + */ + void onClose(CloseContext closeContext) { + final PartitionContext partition = closeContext.getPartitionContext(); + final Set machineIds = partitionsProcessing.remove(partition.getPartitionId()); + + logger.info("Stopped processing partition '{}'. Reason: '{}'", partition.getPartitionId(), + closeContext.getCloseReason()); + + for (String id : machineIds) { + final MachineInformation information = machineInformation.remove(id); + if (information == null) { + continue; + } + + // We may want to persist the last calculated average temperature to a durable store, so another process can + // continue from where this instance left off. + logger.info("Stopped processing temperatures for machine: {}", information.getIdentifier()); + information.close(); + } + } + + /** + * Disposes of all the machine information and closes the processor. + */ + @Override + public void close() { + if (isDisposed.getAndSet(true)) { + return; + } + + partitionsProcessing.clear(); + machineInformation.forEach((key, value) -> value.close()); + machineInformation.clear(); + } +} + +/** + * Contains information about a single machine in the factory. + */ +class MachineInformation implements AutoCloseable { + private final String identifier; + private final Logger logger = LoggerFactory.getLogger(MachineInformation.class); + private final AtomicReference> temperatures = new AtomicReference<>(new ArrayList<>()); + private final ConnectableFlux averageTemperatures; + private final DirectProcessor onDispose = DirectProcessor.create(); + private final AtomicBoolean isDisposed = new AtomicBoolean(); + + private volatile Instant lastReported = Instant.EPOCH; + + /** + * Creates a new instance. + * + * @param identifier Identifier for the machine. + * @param reportingInterval Interval at which to emit average temperature information. + */ + MachineInformation(String identifier, Duration reportingInterval) { + this.identifier = identifier; + this.averageTemperatures = Flux.interval(reportingInterval) + .takeUntilOther(onDispose) + .map(unused -> { + final Instant timeCalculated = Instant.now(); + final List temperaturesInInterval = temperatures.getAndSet(new ArrayList<>()); + if (temperaturesInInterval.size() == 0) { + logger.info("[{}]: Average: null", this.identifier); + return new AverageTemperature(timeCalculated, null); + } + + final int sum = temperaturesInInterval.stream().reduce(0, Integer::sum); + double average = sum / (double) temperaturesInInterval.size(); + + logger.info("[{}]: Average: {}", this.identifier, average); + return new AverageTemperature(timeCalculated, average); + }).publish(); + + averageTemperatures.connect(); + } + + /** + * Submits additional temperature data for that machine. + * + * @param dateEnqueued The time the temperature was acquired. + * @param temperature The temperature. + */ + void onTemperatureEvent(Instant dateEnqueued, int temperature) { + lastReported = dateEnqueued; + temperatures.getAndUpdate(list -> { + list.add(temperature); + return list; + }); + } + + /** + * Gets the machine identifier. + * + * @return The machine identifier. + */ + String getIdentifier() { + return identifier; + } + + /** + * A stream of average temperature information for the machine. + * + * @return Stream of average temperature information. + */ + Flux getAverageTemperatures() { + return averageTemperatures; + } + + /** + * Gets the last reported time. + * + * @return The last reported time. + */ + public Instant getLastReported() { + return lastReported; + } + + /** + * Disposes of the information. + */ + @Override + public void close() { + if (isDisposed.getAndSet(true)) { + return; + } + + final FluxSink sink = onDispose.sink(); + sink.next(true); + sink.complete(); + } +} + +/** + * Average temperature calculation. + */ +class AverageTemperature { + private final Instant timeCalculated; + private final Double temperature; + + /** + * Creates an instance. + * + * @param timeCalculated The time that the average temperature was calculated. + * @param temperature The average temperature in Celsius. {@code null} if there was no data during that period. + */ + AverageTemperature(Instant timeCalculated, Double temperature) { + this.timeCalculated = timeCalculated; + this.temperature = temperature; + } + + /** + * Gets the time that the measurement was calculated. + * + * @return The time that the measurement was calculated. + */ + public Instant getTimeCalculated() { + return timeCalculated; + } + + /** + * Gets the average temperature in Celsius. + * + * @return The average temperature in Celsius, or {@code null} if there was no data when the temperature was + * calculated. + */ + public Double getTemperature() { + return temperature; + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientJavaDocCodeSamples.java similarity index 96% rename from sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientJavaDocCodeSamples.java index d04800c5bd3d..6a43081a63be 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientJavaDocCodeSamples.java @@ -6,7 +6,7 @@ /** * Code snippets for {@link EventProcessorClient}. */ -public final class EventProcessorJavaDocCodeSamples { +public final class EventProcessorClientJavaDocCodeSamples { /** * Code snippet for showing how to start and stop an {@link EventProcessorClient}. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientSample.java similarity index 96% rename from sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientSample.java index 8aea74761e00..63ba02c7a007 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientSample.java @@ -5,16 +5,16 @@ import com.azure.messaging.eventhubs.models.ErrorContext; import com.azure.messaging.eventhubs.models.EventContext; -import java.util.function.Consumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; /** * Sample code to demonstrate how a customer might use {@link EventProcessorClient}. */ -public class EventProcessorSample { +public class EventProcessorClientSample { private static final String EH_CONNECTION_STRING = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; @@ -26,7 +26,7 @@ public class EventProcessorSample { */ public static void main(String[] args) throws Exception { - Logger logger = LoggerFactory.getLogger(EventProcessorSample.class); + Logger logger = LoggerFactory.getLogger(EventProcessorClientSample.class); Consumer processEvent = eventContext -> { logger.info( "Processing event: Event Hub name = {}; consumer group name = {}; partition id = {}; sequence number = {}", @@ -34,6 +34,7 @@ public static void main(String[] args) throws Exception { eventContext.getPartitionContext().getConsumerGroup(), eventContext.getPartitionContext().getPartitionId(), eventContext.getEventData().getSequenceNumber()); + eventContext.updateCheckpoint(); }; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientStateManagement.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientStateManagement.java new file mode 100644 index 000000000000..cf1e16cba759 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientStateManagement.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.CloseReason; +import com.azure.messaging.eventhubs.models.PartitionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrating how to maintain processing state. Counts the number of events that were processed for each + * partition. + * + * @see EventProcessorClientAggregateEventsSample Another sample demonstrating state management. + */ +public class EventProcessorClientStateManagement { + private static final String EH_CONNECTION_STRING = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + private final Logger logger = LoggerFactory.getLogger("Processor"); + /** + * Keeps track of the number of events processed from each partition. + * Key: Partition id + * Value: Number of events processed for each partition. + */ + private final ConcurrentHashMap eventsProcessed = new ConcurrentHashMap<>(); + + /** + * Main method to demonstrate starting and stopping a {@link EventProcessorClient}. + * + * @param args The input arguments to this executable. + * @throws Exception If there are any errors while running the {@link EventProcessorClient}. + */ + public static void main(String[] args) throws Exception { + final EventProcessorClientStateManagement program = new EventProcessorClientStateManagement(); + final EventProcessorClient client = new EventProcessorClientBuilder() + .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME) + .connectionString(EH_CONNECTION_STRING) + .processPartitionInitialization(context -> program.onInitialize(context.getPartitionContext())) + .processPartitionClose(context -> program.onClose(context.getPartitionContext(), context.getCloseReason())) + .processEvent(event -> program.onEvent(event.getPartitionContext(), event.getEventData())) + .processError(error -> program.onError(error.getPartitionContext(), error.getThrowable())) + .checkpointStore(new InMemoryCheckpointStore()) + .buildEventProcessorClient(); + + System.out.println("Starting event processor"); + client.start(); + + // Continue to perform other tasks while the processor is running in the background. + Thread.sleep(TimeUnit.SECONDS.toMillis(30)); + + System.out.println("Stopping event processor"); + client.stop(); + System.out.println("Exiting process"); + } + + /** + * When an occurs, reports that error to a log. + * + * @param partitionContext Context information for the partition in which this error occurred. + * @param error Error that occurred. + */ + void onError(PartitionContext partitionContext, Throwable error) { + logger.error("Error occurred processing partition '{}'. Exception: {}", partitionContext.getPartitionId(), + error); + } + + /** + * On initialisation, keeps track of which partitions it is processing. + * + * @param partitionContext Information about partition it is processing. + */ + void onInitialize(PartitionContext partitionContext) { + logger.info("Starting to process partition {}", partitionContext.getPartitionId()); + eventsProcessed.computeIfAbsent(partitionContext.getPartitionId(), unused -> 0); + } + + /** + * Invoked when a partition is no longer being processed. + * + * @param partitionContext Context information for the partition that is no longer being processed. + * @param reason Reason for no longer processing partition. + */ + void onClose(PartitionContext partitionContext, CloseReason reason) { + logger.info("Stopping processing of partition {}. Reason: {}", partitionContext.getPartitionId(), reason); + eventsProcessed.remove(partitionContext.getPartitionId()); + } + + /** + * Processes an event from the partition. Aggregates the number of events that were processed in this partition. + * + * @param partitionContext Information about which partition this event was in. + * @param eventData Event from the partition. + */ + void onEvent(PartitionContext partitionContext, EventData eventData) { + final Integer count = eventsProcessed.compute(partitionContext.getPartitionId(), + (key, value) -> value == null ? 1 : value + 1); + + logger.info("Event {} received for partition: {}. # of events processed: {}", + eventData.getSequenceNumber(), partitionContext.getPartitionId(), count); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java index 3acc060d8b7a..2ae52053caf5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.messaging.eventhubs; +import com.azure.core.amqp.AmqpRetryMode; +import com.azure.core.amqp.AmqpRetryOptions; import com.azure.messaging.eventhubs.models.CreateBatchOptions; import reactor.core.Exceptions; import reactor.core.publisher.Flux; @@ -14,8 +16,13 @@ import static java.nio.charset.StandardCharsets.UTF_8; /** - * Sample demonstrates how to sent events to specific event hub by defining partition id using {@link - * CreateBatchOptions#setPartitionId(String)}. + * Sample demonstrates how to: + * + *

    + *
  • Send events to specific event hub partition by defining partition id using + * {@link CreateBatchOptions#setPartitionId(String)}.
  • + *
  • Set a custom retry policy for Event Hub operations.
  • + *
*/ public class PublishEventsToSpecificPartition { private static final Duration OPERATION_TIMEOUT = Duration.ofSeconds(30); @@ -33,9 +40,16 @@ public static void main(String[] args) { // 4. Copying the connection string from the policy's properties. String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + // Set some custom retry options other than the default set. + AmqpRetryOptions retryOptions = new AmqpRetryOptions() + .setDelay(Duration.ofSeconds(30)) + .setMaxRetries(2) + .setMode(AmqpRetryMode.EXPONENTIAL); + // Instantiate a client that will be used to call the service. EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString(connectionString) + .retry(retryOptions) .buildAsyncProducerClient(); // To send our events, we need to know what partition to send it to. For the sake of this example, we take the @@ -46,10 +60,10 @@ public static void main(String[] args) { String firstPartition = producer.getPartitionIds().blockFirst(OPERATION_TIMEOUT); // We will publish three events based on simple sentences. - Flux data = Flux.just( - new EventData("EventData Sample 1".getBytes(UTF_8)), - new EventData("EventData Sample 2".getBytes(UTF_8)), - new EventData("EventData Sample 3".getBytes(UTF_8))); + Flux events = Flux.just( + new EventData("This is the first event.".getBytes(UTF_8)), + new EventData("This is the second event.".getBytes(UTF_8)), + new EventData("This is the third event.".getBytes(UTF_8))); // Create a batch to send the events. final CreateBatchOptions options = new CreateBatchOptions() @@ -60,7 +74,7 @@ public static void main(String[] args) { // We try to add as many events as a batch can fit based on the event size and send to Event Hub when // the batch can hold no more events. Create a new batch for next set of events and repeat until all events // are sent. - data.flatMap(event -> { + events.flatMap(event -> { final EventDataBatch batch = currentBatch.get(); if (batch.tryAdd(event)) { return Mono.empty(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java index 775b5b92b295..4a74568de2ba 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java @@ -4,13 +4,10 @@ import com.azure.core.credential.TokenCredential; import com.azure.identity.DefaultAzureCredentialBuilder; -import reactor.core.Exceptions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; import java.time.Duration; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; +import java.util.Arrays; +import java.util.List; import static java.nio.charset.StandardCharsets.UTF_8; @@ -26,7 +23,7 @@ public class PublishEventsWithAzureIdentity { * @param args Unused arguments to the program. */ public static void main(String[] args) { - Flux telemetryEvents = Flux.just( + List telemetryEvents = Arrays.asList( new EventData("Roast beef".getBytes(UTF_8)), new EventData("Cheese".getBytes(UTF_8)), new EventData("Tofu".getBytes(UTF_8)), @@ -47,59 +44,34 @@ public static void main(String[] args) { // Create a producer. // "<>" will look similar to "{your-namespace}.servicebus.windows.net" // "<>" will be the name of the Event Hub instance you created inside the Event Hubs namespace. - EventHubProducerAsyncClient producer = new EventHubClientBuilder() + EventHubProducerClient producer = new EventHubClientBuilder() .credential( "<>", "<>", credential) - .buildAsyncProducerClient(); + .buildProducerClient(); - final AtomicReference currentBatch = new AtomicReference<>( - producer.createBatch().block()); + // Creates an EventDataBatch where the Event Hubs service will automatically load balance the events between all + // available partitions. + EventDataBatch currentBatch = producer.createBatch(); - // The sample Flux contains three events, but it could be an infinite stream of telemetry events. - telemetryEvents.flatMap(event -> { - final EventDataBatch batch = currentBatch.get(); - if (batch.tryAdd(event)) { - return Mono.empty(); + // We try to add as many events as a batch can fit based on the event size and send to Event Hub when + // the batch can hold no more events. Create a new batch for next set of events and repeat until all events + // are sent. + for (EventData event : telemetryEvents) { + if (currentBatch.tryAdd(event)) { + continue; } - // The batch is full, so we create a new batch and send the batch. Mono.when completes when both operations - // have completed. - return Mono.when( - producer.send(batch), - producer.createBatch().map(newBatch -> { - currentBatch.set(newBatch); + // The batch is full, so we create a new batch and send the batch. + producer.send(currentBatch); + currentBatch = producer.createBatch(); - // Add that event that we couldn't before. - if (!newBatch.tryAdd(event)) { - throw Exceptions.propagate(new IllegalArgumentException(String.format( - "Event is too large for an empty batch. Max size: %s. Event: %s", - newBatch.getMaxSizeInBytes(), event.getBodyAsString()))); - } - - return newBatch; - })); - }).then() - .doFinally(signal -> { - final EventDataBatch batch = currentBatch.getAndSet(null); - if (batch != null) { - producer.send(batch).block(OPERATION_TIMEOUT); - } - }) - .subscribe(unused -> System.out.println("Complete"), - error -> System.out.println("Error sending events: " + error), - () -> System.out.println("Completed sending events.")); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(5); - } catch (InterruptedException ignored) { - } finally { - // Disposing of our producer. - producer.close(); + // Add that event that we couldn't before. + if (!currentBatch.tryAdd(event)) { + System.err.printf("Event is too large for an empty batch. Skipping. Max size: %s. Event: %s%n", + currentBatch.getMaxSizeInBytes(), event.getBodyAsString()); + } } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithWebSocketsAndProxy.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithWebSocketsAndProxy.java new file mode 100644 index 000000000000..60b9cf5000df --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithWebSocketsAndProxy.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + + +import com.azure.core.amqp.AmqpTransportType; +import com.azure.core.amqp.ProxyAuthenticationType; +import com.azure.core.amqp.ProxyOptions; + +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.util.Arrays; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Demonstrates how to publish events when using web sockets and a proxy and synchronous producer. + */ +public class PublishEventsWithWebSocketsAndProxy { + /** + * Main method to invoke this sample. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + List telemetryEvents = Arrays.asList( + new EventData("Roast beef".getBytes(UTF_8)), + new EventData("Cheese".getBytes(UTF_8)), + new EventData("Tofu".getBytes(UTF_8)), + new EventData("Turkey".getBytes(UTF_8))); + + // The connection string value can be obtained by: + // 1. Going to your Event Hubs namespace in Azure Portal. + // 2. Creating an Event Hub instance. + // 3. Creating a "Shared access policy" for your Event Hub instance. + // 4. Copying the connection string from the policy's properties. + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + // By default, the AMQP port 5671 is used, but clients can use web sockets, port 443. + // When using web sockets, developers can specify proxy options. + // ProxyOptions.SYSTEM_DEFAULTS can be used if developers want to use the JVM configured proxy. + ProxyOptions proxyOptions = new ProxyOptions(ProxyAuthenticationType.DIGEST, + new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved("10.13.1.3", 9992)), + "digest-user", "digest-user-password"); + + // Instantiate a client that will be used to call the service. + EventHubProducerClient producer = new EventHubClientBuilder() + .transportType(AmqpTransportType.AMQP_WEB_SOCKETS) + .proxyOptions(proxyOptions) + .connectionString(connectionString) + .buildProducerClient(); + + // Creates an EventDataBatch where the Event Hubs service will automatically load balance the events between all + // available partitions. + EventDataBatch currentBatch = producer.createBatch(); + + // We try to add as many events as a batch can fit based on the event size and send to Event Hub when + // the batch can hold no more events. Create a new batch for next set of events and repeat until all events + // are sent. + for (EventData event : telemetryEvents) { + if (currentBatch.tryAdd(event)) { + continue; + } + + // The batch is full, so we create a new batch and send the batch. + producer.send(currentBatch); + currentBatch = producer.createBatch(); + + // Add that event that we couldn't before. + if (!currentBatch.tryAdd(event)) { + System.err.printf("Event is too large for an empty batch. Skipping. Max size: %s. Event: %s%n", + currentBatch.getMaxSizeInBytes(), event.getBodyAsString()); + } + } + + producer.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishStreamOfEvents.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishStreamOfEvents.java new file mode 100644 index 000000000000..58f71414b3b6 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishStreamOfEvents.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.CreateBatchOptions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.DirectProcessor; +import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxSink; +import reactor.core.publisher.Mono; + +import java.time.Duration; +import java.util.Objects; +import java.util.Random; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +/** + * Demonstrates how to continuously publish events using {@link EventHubProducerAsyncClient}. + * {@link CustomPublisher} is publishes size-limited batches when they are full. In addition, it checks for periodically + * for a partial batch that needs to be sent. + */ +public class PublishStreamOfEvents { + private static final String EVENT_NUMBER = "EVENT_NUMBER"; + + /** + * Main method to invoke this demo about how continuously publish a stream of events to Event Hubs. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // The connection string value can be obtained by: + // 1. Going to your Event Hubs namespace in Azure Portal. + // 2. Creating an Event Hub instance. + // 3. Creating a "Shared access policy" for your Event Hub instance. + // 4. Copying the connection string from the policy's properties. + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + // Limit the size of the batches to 1024 bytes instead of using the default max size. + final CreateBatchOptions batchOptions = new CreateBatchOptions().setMaximumSizeInBytes(1024); + final CustomPublisher publisher = new CustomPublisher(connectionString, Duration.ofSeconds(1), batchOptions); + + // This represents a stream of events that we want to publish. + final DirectProcessor events = DirectProcessor.create(); + + System.out.println("Publishing events..."); + publisher.publish(events).subscribe(unused -> System.out.println("Completed."), + error -> System.err.println("Error sending events: " + error), + () -> System.out.println("Completed sending events.")); + + emitEvents(events.sink()); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. + try { + TimeUnit.SECONDS.sleep(10); + } catch (InterruptedException ignored) { + } finally { + System.out.println("Closing custom publisher."); + publisher.close(); + } + } + + /** + * Helper function that emits 50 events. The interval between each event is randomly selected between 0 - 250ms and + * is a random substring of the lorem ipsum text. + * + * @param sink Sink for generated events. + */ + private static void emitEvents(FluxSink sink) { + final String contents = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " + + "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " + + "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " + + "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur" + + " sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est " + + "laborum."; + final Random random = new Random(); + + for (int i = 0; i < 50; i++) { + int milliseconds = random.nextInt(250); + + try { + TimeUnit.MILLISECONDS.sleep(milliseconds); + } catch (InterruptedException ignored) { + } + + final int size = random.nextInt(contents.length()); + final int endIndex = size < 1 ? contents.length() : size; + final EventData event = new EventData(contents.substring(0, endIndex)); + event.getProperties().put(EVENT_NUMBER, String.valueOf(i)); + + sink.next(event); + } + + sink.complete(); + } + + /** + * Aggregates events into batches based on the given {@link CreateBatchOptions} and sends the batches to the Event + * Hubs service when either: + * + *
    + *
  • The batch has reached its max size and no more events can be added to it.
  • + *
  • The timeout window has elapsed.
  • + *
+ */ + private static class CustomPublisher implements AutoCloseable { + private final Logger logger = LoggerFactory.getLogger(CustomPublisher.class); + private final AtomicBoolean isDisposed = new AtomicBoolean(); + private final AtomicReference currentBatch = new AtomicReference<>(); + private final EventHubProducerAsyncClient producer; + private final CreateBatchOptions batchOptions; + private final Duration windowDuration; + + /** + * Creates a new instance of {@link CustomPublisher}. + * + * @param connectionString Connection string for the specific Event Hub. + * @param windowDuration Intervals to check for an available {@link EventDataBatch} to send. + * @param batchOptions Options to use when creating the {@link EventDataBatch}. If {@code null}, the default + * batch options are used. + */ + CustomPublisher(String connectionString, Duration windowDuration, CreateBatchOptions batchOptions) { + producer = new EventHubClientBuilder() + .connectionString(connectionString) + .buildAsyncProducerClient(); + + this.batchOptions = batchOptions != null ? batchOptions : new CreateBatchOptions(); + this.windowDuration = Objects.requireNonNull(windowDuration, "'windowDuration' cannot be null."); + } + + /** + * Subscribes to a stream of events and publishes event batches when: + * + *
    + *
  • The {@link EventDataBatch} is full.
  • + *
  • Timeout window has elapsed and there is a batch.
  • + *
+ * + * @param events Events to publish to the service. + * + * @return Mono that completes when all the events have been published. + */ + Mono publish(Flux events) { + final Flux fullBatchFlux = Flux.create(sink -> { + events.subscribe(event -> { + // For each event, tries to add it to the current batch. If the current batch is full, then we emit + // that. Otherwise an empty Mono is emitted. + // Blocking at the very end of the method to ensure that the event is added to a batch before + // requesting another event. + getOrCreateBatch() + .flatMap(batch -> batch.tryAdd(event) ? Mono.empty() : Mono.just(batch)) + .flatMap(fullBatch -> { + sink.next(fullBatch); + + return createBatch().map(newBatch -> { + if (!newBatch.tryAdd(event)) { + sink.error(new IllegalArgumentException(String.format( + "Event is too large for an empty batch. Max size: %s. Event: %s", + newBatch.getMaxSizeInBytes(), event.getBodyAsString()))); + } + return newBatch; + }); + }).block(); + }, error -> { + sink.error(new RuntimeException("Error fetching next event.", error)); + }, () -> { + final EventDataBatch lastBatch = currentBatch.getAndSet(null); + if (lastBatch != null) { + sink.next(lastBatch); + } + + sink.complete(); + }); + }).publish().autoConnect(); + + // Periodically checks to see if there is an available, not full, batch to send. If there is, it sends that + // batch. It keeps checking for an available batch until the last event in `events` has been published. + final Flux emitAtIntervals = Flux.interval(windowDuration) + .takeUntilOther(events.then()) + .flatMap(v -> { + final EventDataBatch batch = currentBatch.getAndSet(null); + logger.info("Interval check. Has items? {}", batch != null && batch.getCount() > 0); + return batch != null ? Mono.just(batch) : Mono.empty(); + }); + + // Merge the two fluxes together so the results + return Flux.merge(fullBatchFlux, emitAtIntervals) + .flatMap(batchToSend -> { + final String eventNumbers = batchToSend.getEvents() + .stream() + .map(e -> e.getProperties().getOrDefault(EVENT_NUMBER, "n/a").toString()) + .collect(Collectors.joining(", ")); + + logger.info("Sending batch with {} events. Size: {} bytes. Event numbers in batch [{}]", + batchToSend.getCount(), batchToSend.getSizeInBytes(), eventNumbers); + + return producer.send(batchToSend); + }) + .then(); + } + + private Mono getOrCreateBatch() { + final EventDataBatch current = currentBatch.get(); + return current != null + ? Mono.just(current) + : createBatch(); + } + + private Mono createBatch() { + return producer.createBatch(batchOptions).map(batch -> { + currentBatch.set(batch); + return batch; + }); + } + + public void close() { + if (isDisposed.getAndSet(true)) { + return; + } + + final EventDataBatch batch = currentBatch.getAndSet(null); + if (batch != null) { + producer.send(batch).block(Duration.ofSeconds(30)); + } + + producer.close(); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ReadmeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ReadmeSamples.java new file mode 100644 index 000000000000..be2d68950331 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ReadmeSamples.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.IterableStream; +import com.azure.identity.ClientSecretCredential; +import com.azure.identity.ClientSecretCredentialBuilder; +import com.azure.messaging.eventhubs.models.CreateBatchOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.PartitionEvent; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS ARE USED TO EXTRACT + * APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING LINE NUMBERS OF EXISTING CODE + * SAMPLES. + * + * Class containing code snippets that will be injected to README.md. + */ +public class ReadmeSamples { + + /** + * Code sample for creating a synchronous Event Hub producer. + */ + public void createSynchronousEventHubProducer() { + String connectionString = "<< CONNECTION STRING FOR THE EVENT HUBS NAMESPACE >>"; + String eventHubName = "<< NAME OF THE EVENT HUB >>"; + EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString(connectionString, eventHubName) + .buildProducerClient(); + } + + /** + * Code sample for using AAD authorization to create a client. + */ + public void useAadAuthorization() { + ClientSecretCredential credential = new ClientSecretCredentialBuilder() + .clientId("<< APPLICATION (CLIENT) ID >>") + .clientSecret("<< APPLICATION SECRET >>") + .tenantId("<< DIRECTORY (TENANT) ID >>") + .build(); + + // The fully qualified namespace for the Event Hubs instance. This is likely to be similar to: + // {your-namespace}.servicebus.windows.net + String fullyQualifiedNamespace = "my-test-eventhubs.servicebus.windows.net"; + String eventHubName = "<< NAME OF THE EVENT HUB >>"; + EventHubProducerClient client = new EventHubClientBuilder() + .credential(fullyQualifiedNamespace, eventHubName, credential) + .buildProducerClient(); + } + + /** + * Code sample for publishing events. + * @throws IllegalArgumentException if the event data is bigger than max batch size. + */ + public void publishEvents() { + EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildProducerClient(); + + List allEvents = Arrays.asList(new EventData("Foo"), new EventData("Bar")); + EventDataBatch eventDataBatch = producer.createBatch(); + + for (EventData eventData : allEvents) { + if (!eventDataBatch.tryAdd(eventData)) { + producer.send(eventDataBatch); + eventDataBatch = producer.createBatch(); + + // Try to add that event that couldn't fit before. + if (!eventDataBatch.tryAdd(eventData)) { + throw new IllegalArgumentException("Event is too large for an empty batch. Max size: " + + eventDataBatch.getMaxSizeInBytes()); + } + } + } + // send the last batch of remaining events + if (eventDataBatch.getCount() > 0) { + producer.send(eventDataBatch); + } + } + + /** + * Code sample for publishing events to a specific partition. + */ + public void publishEventsToPartition() { + EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildProducerClient(); + + CreateBatchOptions options = new CreateBatchOptions().setPartitionId("0"); + EventDataBatch batch = producer.createBatch(options); + + // Add events to batch and when you want to send the batch, send it using the producer. + producer.send(batch); + } + + /** + * Code sample for publishing events with a partition key. + */ + public void publishEventsWithPartitionKey() { + EventHubProducerClient producer = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildProducerClient(); + + CreateBatchOptions batchOptions = new CreateBatchOptions().setPartitionKey("grouping-key"); + EventDataBatch eventDataBatch = producer.createBatch(batchOptions); + + // Add events to batch and when you want to send the batch, send it using the producer. + producer.send(eventDataBatch); + } + + /** + * Code sample for consuming events from a specific partition. + */ + public void consumeEventsFromPartition() { + EventHubConsumerAsyncClient consumer = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME) + .buildAsyncConsumerClient(); + + // Receive events from partition with id "0", only getting events that are newly added to the partition. + consumer.receiveFromPartition("0", EventPosition.latest()).subscribe(event -> { + // Process each event as it arrives. + }); + } + + /** + * Code sample for consuming events from synchronous client. + */ + public void consumeEventsFromPartitionUsingSyncClient() { + EventHubConsumerClient consumer = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME) + .buildConsumerClient(); + + String partitionId = "<< EVENT HUB PARTITION ID >>"; + + // Get the first 15 events in the stream, or as many events as can be received within 40 seconds. + IterableStream events = consumer.receiveFromPartition(partitionId, 15, + EventPosition.earliest(), Duration.ofSeconds(40)); + for (PartitionEvent event : events) { + System.out.println("Event: " + event.getData().getBodyAsString()); + } + } + + /** + * Code sample for using Event Processor to consume events. + * @throws InterruptedException if the thread is interrupted. + */ + public void consumeEventsUsingEventProcessor() throws InterruptedException { + EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup("<< CONSUMER GROUP NAME >>") + .connectionString("<< EVENT HUB CONNECTION STRING >>") + .checkpointStore(new InMemoryCheckpointStore()) + .processEvent(eventContext -> { + System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " + + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + }) + .processError(errorContext -> { + System.out + .println("Error occurred while processing events " + errorContext.getThrowable().getMessage()); + }) + .buildEventProcessorClient(); + + // This will start the processor. It will start processing events from all partitions. + eventProcessorClient.start(); + + // (for demo purposes only - adding sleep to wait for receiving events) + TimeUnit.SECONDS.sleep(2); + + // This will stop processing events. + eventProcessorClient.stop(); + } +} + diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java index 2d0ab37cf2eb..2d5ca832bec0 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java @@ -238,32 +238,6 @@ public void receiveMessageFromEnqueuedTimeReceivedMessage() { } } - /** - * Tests that we can get an event using the inclusive offset. - */ - @Test - public void receiveMessageFromOffsetInclusive() { - // Arrange - final EventData[] events = EVENTS_PUSHED.get(); - final EventData expectedEvent = events[4]; - final EventPosition position = EventPosition.fromOffset(expectedEvent.getOffset()); - final EventHubConsumerAsyncClient consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, DEFAULT_PREFETCH_COUNT); - - // Act & Assert - try { - StepVerifier.create(consumer.receiveFromPartition(PARTITION_ID, position).map(PartitionEvent::getData) - .filter(event -> isMatchingEvent(event, testData.getMessageTrackingId())) - .take(1)) - .assertNext(event -> { - Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); - Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); - Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); - }).verifyComplete(); - } finally { - dispose(consumer); - } - } - /** * Tests that we can get an event using the non-inclusive offset. */ diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientErrorHandlingTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientErrorHandlingTest.java new file mode 100644 index 000000000000..2617fbb7ba85 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientErrorHandlingTest.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import static com.azure.messaging.eventhubs.EventHubClientBuilder.DEFAULT_PREFETCH_COUNT; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + +import com.azure.messaging.eventhubs.implementation.PartitionProcessor; +import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.CloseContext; +import com.azure.messaging.eventhubs.models.ErrorContext; +import com.azure.messaging.eventhubs.models.EventContext; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.InitializationContext; +import com.azure.messaging.eventhubs.models.PartitionContext; +import com.azure.messaging.eventhubs.models.PartitionEvent; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import com.azure.messaging.eventhubs.models.ReceiveOptions; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Unit tests for {@link EventProcessorClient} error handling. + */ +public class EventProcessorClientErrorHandlingTest { + + private static final String NAMESPACE_NAME = "dummyNamespaceName"; + private static final String DEFAULT_DOMAIN_NAME = "servicebus.windows.net/"; + + @Mock + private EventHubClientBuilder eventHubClientBuilder; + + @Mock + private EventHubAsyncClient eventHubAsyncClient; + + @Mock + private EventHubConsumerAsyncClient eventHubConsumer; + + @Mock + private EventData eventData1; + + private CountDownLatch countDownLatch; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1", "2", "3")); + when(eventHubAsyncClient.getFullyQualifiedNamespace()).thenReturn("test-ns"); + when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); + } + + @ParameterizedTest(name = "{displayName} with [{arguments}]") + @MethodSource("checkpointStoreSupplier") + public void testCheckpointStoreErrors(CheckpointStore checkpointStore) throws InterruptedException { + countDownLatch = new CountDownLatch(1); + EventProcessorClient client = new EventProcessorClient(eventHubClientBuilder, "cg", + () -> new TestPartitionProcessor(), checkpointStore, false, + null, errorContext -> { + countDownLatch.countDown(); + Assertions.assertEquals("NONE", errorContext.getPartitionContext().getPartitionId()); + Assertions.assertEquals("cg", errorContext.getPartitionContext().getConsumerGroup()); + Assertions.assertTrue(errorContext.getThrowable() instanceof IllegalStateException); + }, new HashMap<>()); + client.start(); + boolean completed = countDownLatch.await(3, TimeUnit.SECONDS); + client.stop(); + Assertions.assertTrue(completed); + } + + @Test + public void testProcessEventHandlerError() throws InterruptedException { + countDownLatch = new CountDownLatch(1); + when(eventHubAsyncClient.createConsumer("cg", DEFAULT_PREFETCH_COUNT)).thenReturn(eventHubConsumer); + when(eventHubConsumer.receiveFromPartition(anyString(), any(EventPosition.class), any(ReceiveOptions.class))) + .thenReturn(Flux.just(getEvent(eventData1))); + EventProcessorClient client = new EventProcessorClient(eventHubClientBuilder, "cg", + () -> new BadProcessEventHandler(countDownLatch), new InMemoryCheckpointStore(), false, + null, errorContext -> { }, new HashMap<>()); + client.start(); + boolean completed = countDownLatch.await(3, TimeUnit.SECONDS); + client.stop(); + Assertions.assertTrue(completed); + } + + @Test + public void testInitHandlerError() throws InterruptedException { + countDownLatch = new CountDownLatch(1); + when(eventHubAsyncClient.createConsumer("cg", DEFAULT_PREFETCH_COUNT)).thenReturn(eventHubConsumer); + when(eventHubConsumer.receiveFromPartition(anyString(), any(EventPosition.class), any(ReceiveOptions.class))) + .thenReturn(Flux.just(getEvent(eventData1))); + EventProcessorClient client = new EventProcessorClient(eventHubClientBuilder, "cg", + () -> new BadInitHandler(countDownLatch), new InMemoryCheckpointStore(), false, + null, errorContext -> { }, new HashMap<>()); + client.start(); + boolean completed = countDownLatch.await(3, TimeUnit.SECONDS); + client.stop(); + Assertions.assertTrue(completed); + } + + @Test + public void testCloseHandlerError() throws InterruptedException { + countDownLatch = new CountDownLatch(1); + when(eventHubAsyncClient.createConsumer("cg", DEFAULT_PREFETCH_COUNT)).thenReturn(eventHubConsumer); + when(eventHubConsumer.receiveFromPartition(anyString(), any(EventPosition.class), any(ReceiveOptions.class))) + .thenReturn(Flux.just(getEvent(eventData1))); + EventProcessorClient client = new EventProcessorClient(eventHubClientBuilder, "cg", + () -> new BadCloseHandler(countDownLatch), new InMemoryCheckpointStore(), false, + null, errorContext -> { }, new HashMap<>()); + client.start(); + boolean completed = countDownLatch.await(3, TimeUnit.SECONDS); + client.stop(); + Assertions.assertTrue(completed); + } + + private static Stream checkpointStoreSupplier() { + return Stream.of( + Arguments.of(new ListOwnershipErrorStore()), + Arguments.of(new ClaimOwnershipErrorStore()), + Arguments.of(new ListCheckpointErrorStore())); + } + + private PartitionEvent getEvent(EventData event) { + PartitionContext context = new PartitionContext("ns", "foo", "bar", "baz"); + return new PartitionEvent(context, event, null); + } + + + private static class ListOwnershipErrorStore implements CheckpointStore { + + @Override + public Flux listOwnership( + String fullyQualifiedNamespace, String eventHubName, String consumerGroup) { + return Flux.error(new IllegalStateException("List ownership error")); + } + + @Override + public Flux claimOwnership( + List requestedPartitionOwnerships) { + return null; + } + + @Override + public Flux listCheckpoints(String fullyQualifiedNamespace, + String eventHubName, String consumerGroup) { + return null; + } + + @Override + public Mono updateCheckpoint(Checkpoint checkpoint) { + return null; + } + } + + private static class ClaimOwnershipErrorStore implements CheckpointStore { + + @Override + public Flux listOwnership( + String fullyQualifiedNamespace, String eventHubName, String consumerGroup) { + return Flux.empty(); + } + + @Override + public Flux claimOwnership( + List requestedPartitionOwnerships) { + return Flux.error(new IllegalStateException("Claim Ownership error")); + } + + @Override + public Flux listCheckpoints(String fullyQualifiedNamespace, + String eventHubName, String consumerGroup) { + return null; + } + + @Override + public Mono updateCheckpoint(Checkpoint checkpoint) { + return null; + } + } + + private static class ListCheckpointErrorStore implements CheckpointStore { + + @Override + public Flux listOwnership( + String fullyQualifiedNamespace, String eventHubName, String consumerGroup) { + return Flux.empty(); + } + + @Override + public Flux claimOwnership( + List requestedPartitionOwnerships) { + return Flux.fromIterable(requestedPartitionOwnerships); + } + + @Override + public Flux listCheckpoints(String fullyQualifiedNamespace, + String eventHubName, String consumerGroup) { + return Flux.error(new IllegalStateException("List checkpoint error")); + } + + @Override + public Mono updateCheckpoint(Checkpoint checkpoint) { + return null; + } + } + + private static final class TestPartitionProcessor extends PartitionProcessor { + + @Override + public void processEvent(EventContext eventContext) { + eventContext.updateCheckpoint(); + } + + @Override + public void processError(ErrorContext errorContext) { + // do nothing + return; + } + } + + private static final class BadProcessEventHandler extends PartitionProcessor { + + CountDownLatch countDownLatch; + + BadProcessEventHandler(CountDownLatch countDownLatch) { + this.countDownLatch = countDownLatch; + } + + @Override + public void processEvent(EventContext eventContext) { + countDownLatch.countDown(); + throw new IllegalStateException("Process event error"); + } + + @Override + public void processError(ErrorContext errorContext) { + Assertions.fail("Process error handler should not be called when process event throws exception"); + return; + } + } + + private static final class BadInitHandler extends PartitionProcessor { + + CountDownLatch countDownLatch; + + BadInitHandler(CountDownLatch countDownLatch) { + this.countDownLatch = countDownLatch; + } + + @Override + public void initialize(InitializationContext initContext) { + countDownLatch.countDown(); + throw new IllegalStateException("Init error"); + } + + @Override + public void processEvent(EventContext eventContext) { + Assertions.fail("Process event handler should not be called when there's an error during initialization"); + } + + @Override + public void processError(ErrorContext errorContext) { + Assertions.fail("Process error handler should not be called when process event throws exception"); + return; + } + } + + private static final class BadCloseHandler extends PartitionProcessor { + + CountDownLatch countDownLatch; + BadCloseHandler(CountDownLatch countDownLatch) { + this.countDownLatch = countDownLatch; + } + + @Override + public void close(CloseContext closeContext) { + countDownLatch.countDown(); + throw new IllegalStateException("Close error"); + } + + @Override + public void processEvent(EventContext eventContext) { + // do nothing + } + + @Override + public void processError(ErrorContext errorContext) { + // do nothing + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientTest.java index d21a3d870b4e..1cc88baed6ed 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientTest.java @@ -140,7 +140,7 @@ public void testWithSimplePartitionProcessor() throws Exception { // Act final EventProcessorClient eventProcessorClient = new EventProcessorClient(eventHubClientBuilder, "test-consumer", - () -> testPartitionProcessor, EventPosition.earliest(), checkpointStore, false, tracerProvider); + () -> testPartitionProcessor, checkpointStore, false, tracerProvider, ec -> { }, new HashMap<>()); eventProcessorClient.start(); TimeUnit.SECONDS.sleep(10); eventProcessorClient.stop(); @@ -170,117 +170,6 @@ public void testWithSimplePartitionProcessor() throws Exception { verify(consumer1, atLeastOnce()).close(); } - /** - * Tests {@link EventProcessorClient} with a partition processor that throws an exception when processing an event. - * - * @throws Exception if an error occurs while running the test. - */ - @Test - public void testWithFaultyPartitionProcessor() throws Exception { - // Arrange - final Tracer tracer1 = mock(Tracer.class); - final List tracers = Collections.singletonList(tracer1); - TracerProvider tracerProvider = new TracerProvider(tracers); - when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient); - when(eventHubAsyncClient.getFullyQualifiedNamespace()).thenReturn("test-ns"); - when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); - when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); - when(eventHubAsyncClient - .createConsumer(anyString(), anyInt())) - .thenReturn(consumer1); - when(consumer1.receiveFromPartition(anyString(), any(EventPosition.class), any(ReceiveOptions.class))).thenReturn(Flux.just(getEvent(eventData1))); - String diagnosticId = "00-08ee063508037b1719dddcbf248e30e2-1365c684eb25daed-01"; - - final InMemoryCheckpointStore checkpointStore = new InMemoryCheckpointStore(); - final FaultyPartitionProcessor faultyPartitionProcessor = new FaultyPartitionProcessor(); - - when(tracer1.extractContext(eq(diagnosticId), any())).thenAnswer( - invocation -> { - Context passed = invocation.getArgument(1, Context.class); - return passed.addData(SPAN_CONTEXT_KEY, "value"); - } - ); - when(tracer1.start(eq("EventHubs.process"), any(), eq(ProcessKind.PROCESS))).thenAnswer( - invocation -> { - Context passed = invocation.getArgument(1, Context.class); - return passed.addData(SPAN_CONTEXT_KEY, "value1") - .addData("scope", (Closeable) () -> { - }) - .addData(PARENT_SPAN_KEY, "value2"); - } - ); - // Act - final EventProcessorClient eventProcessorClient = new EventProcessorClient(eventHubClientBuilder, "test-consumer", - () -> faultyPartitionProcessor, EventPosition.earliest(), checkpointStore, false, tracerProvider); - - eventProcessorClient.start(); - TimeUnit.SECONDS.sleep(10); - eventProcessorClient.stop(); - - // Assert - assertTrue(faultyPartitionProcessor.error); - } - - /** - * Tests process start spans error messages invoked for {@link EventProcessorClient}. - * - * @throws Exception if an error occurs while running the test. - */ - @Test - public void testErrorProcessSpans() throws Exception { - //Arrange - final Tracer tracer1 = mock(Tracer.class); - final List tracers = Collections.singletonList(tracer1); - TracerProvider tracerProvider = new TracerProvider(tracers); - when(eventHubClientBuilder.buildAsyncClient()).thenReturn(eventHubAsyncClient); - when(eventHubAsyncClient.getFullyQualifiedNamespace()).thenReturn("test-ns"); - when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); - when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); - when(eventHubAsyncClient - .createConsumer(anyString(), anyInt())) - .thenReturn(consumer1); - when(eventData1.getSequenceNumber()).thenReturn(1L); - when(eventData2.getSequenceNumber()).thenReturn(2L); - when(eventData1.getOffset()).thenReturn(1L); - when(eventData2.getOffset()).thenReturn(100L); - - String diagnosticId = "00-08ee063508037b1719dddcbf248e30e2-1365c684eb25daed-01"; - Map properties = new HashMap<>(); - properties.put(DIAGNOSTIC_ID_KEY, diagnosticId); - - when(eventData1.getProperties()).thenReturn(properties); - when(consumer1.receiveFromPartition(anyString(), any(EventPosition.class), any(ReceiveOptions.class))).thenReturn(Flux.just(getEvent(eventData1))); - when(tracer1.extractContext(eq(diagnosticId), any())).thenAnswer( - invocation -> { - Context passed = invocation.getArgument(1, Context.class); - return passed.addData(SPAN_CONTEXT_KEY, "value"); - } - ); - when(tracer1.start(eq("EventHubs.process"), any(), eq(ProcessKind.PROCESS))).thenAnswer( - invocation -> { - Context passed = invocation.getArgument(1, Context.class); - return passed.addData(SPAN_CONTEXT_KEY, "value1") - .addData("scope", (Closeable) () -> { - }) - .addData(PARENT_SPAN_KEY, "value2"); - } - ); - - final InMemoryCheckpointStore checkpointStore = new InMemoryCheckpointStore(); - - //Act - final EventProcessorClient eventProcessorClient = new EventProcessorClient(eventHubClientBuilder, "test-consumer", - FaultyPartitionProcessor::new, EventPosition.earliest(), checkpointStore, false, tracerProvider); - eventProcessorClient.start(); - TimeUnit.SECONDS.sleep(10); - eventProcessorClient.stop(); - - //Assert - verify(tracer1, times(1)).extractContext(eq(diagnosticId), any()); - verify(tracer1, times(1)).start(eq("EventHubs.process"), any(), eq(ProcessKind.PROCESS)); - verify(tracer1, times(1)).end(eq(""), any(IllegalStateException.class), any()); - } - /** * Tests process start spans invoked for {@link EventProcessorClient}. * @@ -329,7 +218,7 @@ public void testProcessSpans() throws Exception { //Act final EventProcessorClient eventProcessorClient = new EventProcessorClient(eventHubClientBuilder, "test-consumer", - TestPartitionProcessor::new, EventPosition.earliest(), checkpointStore, false, tracerProvider); + TestPartitionProcessor::new, checkpointStore, false, tracerProvider, ec -> { }, new HashMap<>()); eventProcessorClient.start(); TimeUnit.SECONDS.sleep(10); @@ -391,7 +280,7 @@ public void testWithMultiplePartitions() throws Exception { // Act final EventProcessorClient eventProcessorClient = new EventProcessorClient(eventHubClientBuilder, "test-consumer", - TestPartitionProcessor::new, position, checkpointStore, false, tracerProvider); + TestPartitionProcessor::new, checkpointStore, false, tracerProvider, ec -> { }, new HashMap<>()); eventProcessorClient.start(); final boolean completed = count.await(10, TimeUnit.SECONDS); eventProcessorClient.stop(); @@ -420,21 +309,6 @@ private PartitionEvent getEvent(EventData event) { return new PartitionEvent(context, event, null); } - private static final class FaultyPartitionProcessor extends PartitionProcessor { - - boolean error; - - @Override - public void processError(ErrorContext errorContext) { - error = true; - } - - @Override - public void processEvent(EventContext partitionEvent) { - throw new IllegalStateException(); - } - } - private static final class TestPartitionProcessor extends PartitionProcessor { @Override diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java index e6f1fc55ec33..de157d90a047 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInfo; import org.mockito.Mockito; +import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; import java.io.Closeable; @@ -51,6 +52,7 @@ public abstract class IntegrationTestBase extends TestBase { private ConnectionStringProperties properties; private String testName; + private final Scheduler scheduler = Schedulers.newParallel("eh-integration"); protected IntegrationTestBase(ClientLogger logger) { this.logger = logger; @@ -73,6 +75,7 @@ public void setupTest(TestInfo testInfo) { @AfterEach public void teardownTest(TestInfo testInfo) { logger.info("[{}]: Performing test clean-up.", testInfo.getDisplayName()); + scheduler.dispose(); afterTest(); // Tear down any inline mocks to avoid memory leaks. @@ -161,7 +164,7 @@ protected EventHubClientBuilder createBuilder(boolean useCredentials) { .proxyOptions(ProxyOptions.SYSTEM_DEFAULTS) .retry(RETRY_OPTIONS) .transportType(AmqpTransportType.AMQP) - .scheduler(Schedulers.newParallel("eh-integration")); + .scheduler(scheduler); if (useCredentials) { final String fqdn = getFullyQualifiedDomainName(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java index eaeb4d322e32..671ed8dd3b0f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java @@ -14,6 +14,7 @@ import com.azure.messaging.eventhubs.models.PartitionEvent; import com.azure.messaging.eventhubs.models.PartitionOwnership; import com.azure.messaging.eventhubs.models.ReceiveOptions; +import java.util.HashMap; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -312,11 +313,11 @@ public void testReceiveFailure() throws Exception { .thenReturn(Flux.error(new IllegalStateException())); PartitionPumpManager partitionPumpManager = new PartitionPumpManager(checkpointStore, - () -> partitionProcessor, EventPosition.earliest(), - eventHubClientBuilder, false, tracerProvider); + () -> partitionProcessor, eventHubClientBuilder, false, tracerProvider, new HashMap<>()); PartitionBasedLoadBalancer loadBalancer = new PartitionBasedLoadBalancer(checkpointStore, eventHubAsyncClient, fqNamespace, eventHubName, consumerGroupName, "owner", TimeUnit.SECONDS.toSeconds(5), - partitionPumpManager); + partitionPumpManager, ec -> { + }); loadBalancer.loadBalance(); sleep(2); verify(partitionProcessor, never()).processEvent(any(EventContext.class)); @@ -337,10 +338,11 @@ public void testCheckpointStoreFailure() throws Exception { List partitionIds = Arrays.asList("1", "2", "3"); when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); PartitionPumpManager partitionPumpManager = new PartitionPumpManager(checkpointStore, - () -> partitionProcessor, EventPosition.earliest(), eventHubClientBuilder, false, tracerProvider); + () -> partitionProcessor, eventHubClientBuilder, false, tracerProvider, new HashMap<>()); PartitionBasedLoadBalancer loadBalancer = new PartitionBasedLoadBalancer(checkpointStore, eventHubAsyncClient, fqNamespace, eventHubName, consumerGroupName, "owner", TimeUnit.SECONDS.toSeconds(5), - partitionPumpManager); + partitionPumpManager, ec -> { + }); loadBalancer.loadBalance(); sleep(5); verify(eventHubAsyncClient, atLeast(1)).getPartitionIds(); @@ -362,10 +364,11 @@ public void testEventHubClientFailure() { List partitionIds = new ArrayList<>(); when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); PartitionPumpManager partitionPumpManager = new PartitionPumpManager(checkpointStore, - () -> partitionProcessor, EventPosition.earliest(), eventHubClientBuilder, false, tracerProvider); + () -> partitionProcessor, eventHubClientBuilder, false, tracerProvider, new HashMap<>()); PartitionBasedLoadBalancer loadBalancer = new PartitionBasedLoadBalancer(checkpointStore, eventHubAsyncClient, fqNamespace, eventHubName, consumerGroupName, "owner", TimeUnit.SECONDS.toSeconds(5), - partitionPumpManager); + partitionPumpManager, ec -> { + }); loadBalancer.loadBalance(); sleep(2); verify(eventHubAsyncClient, atLeast(1)).getPartitionIds(); @@ -458,8 +461,9 @@ public void processError(ErrorContext eventProcessingErrorContext) { eventProcessingErrorContext.getPartitionContext().getPartitionId(), eventProcessingErrorContext.getThrowable()); } - }, EventPosition.earliest(), eventHubClientBuilder, false, tracerProvider); + }, eventHubClientBuilder, false, tracerProvider, new HashMap<>()); return new PartitionBasedLoadBalancer(checkpointStore, eventHubAsyncClient, fqNamespace, - eventHubName, consumerGroupName, owner, TimeUnit.SECONDS.toSeconds(5), partitionPumpManager); + eventHubName, consumerGroupName, owner, TimeUnit.SECONDS.toSeconds(5), partitionPumpManager, + ec -> { }); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java index 3a6b4bb3aa93..51458dbec9ae 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java @@ -23,7 +23,9 @@ import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.IntegrationTestBase; +import java.util.Map; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -45,11 +47,20 @@ public class CBSChannelTest extends IntegrationTestBase { private AzureTokenManagerProvider azureTokenManagerProvider; @Mock private MessageSerializer messageSerializer; + private static String product; + private static String clientVersion; public CBSChannelTest() { super(new ClientLogger(CBSChannelTest.class)); } + @BeforeAll + public static void init() { + Map properties = CoreUtils.getProperties("azure-messaging-eventhubs.properties"); + product = properties.get("name"); + clientVersion = properties.get("version"); + } + @Override protected void beforeTest() { MockitoAnnotations.initMocks(this); @@ -69,7 +80,7 @@ protected void beforeTest() { ReactorProvider reactorProvider = new ReactorProvider(); ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(reactorProvider); connection = new TestReactorConnection(CONNECTION_ID, connectionOptions, reactorProvider, handlerProvider, - azureTokenManagerProvider, messageSerializer); + azureTokenManagerProvider, messageSerializer, product, clientVersion); final Mono requestResponseChannel = connection.getCBSChannel(); @@ -126,11 +137,13 @@ public void unsuccessfulAuthorize() { } private static final class TestReactorConnection extends ReactorConnection { + private TestReactorConnection(String connectionId, ConnectionOptions connectionOptions, - ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, - TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer) { + ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, + TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer, + String product, String clientVersion) { super(connectionId, connectionOptions, reactorProvider, handlerProvider, tokenManagerProvider, - messageSerializer); + messageSerializer, product, clientVersion); } private Mono getCBSChannel() { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java index 485612210e05..bc483e58368a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java @@ -15,11 +15,14 @@ import com.azure.core.amqp.implementation.TokenManagerProvider; import com.azure.core.amqp.implementation.handler.ConnectionHandler; import com.azure.core.credential.TokenCredential; +import com.azure.core.util.CoreUtils; +import java.util.Map; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Selectable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; @@ -55,10 +58,20 @@ public class EventHubReactorConnectionTest { @Mock private ReactorHandlerProvider handlerProvider; private ConnectionOptions connectionOptions; + private static String product; + private static String clientVersion; + + @BeforeAll + public static void init() throws Exception { + Map properties = CoreUtils.getProperties("azure-messaging-eventhubs.properties"); + product = properties.get("name"); + clientVersion = properties.get("version"); + } @BeforeEach public void setup() throws IOException { - final ConnectionHandler connectionHandler = new ConnectionHandler(CONNECTION_ID, HOSTNAME); + final ConnectionHandler connectionHandler = new ConnectionHandler(CONNECTION_ID, HOSTNAME, product, + clientVersion); MockitoAnnotations.initMocks(this); @@ -78,15 +91,17 @@ tokenCredential, CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, AmqpTransportType when(reactorProvider.createReactor(connectionHandler.getConnectionId(), connectionHandler.getMaxFrameSize())) .thenReturn(reactor); - when(handlerProvider.createConnectionHandler(CONNECTION_ID, HOSTNAME, AmqpTransportType.AMQP, proxy)) + when(handlerProvider.createConnectionHandler(CONNECTION_ID, HOSTNAME, AmqpTransportType.AMQP, proxy, product, + clientVersion)) .thenReturn(connectionHandler); } @Test public void getsManagementChannel() { // Arrange - final EventHubReactorAmqpConnection connection = new EventHubReactorAmqpConnection(CONNECTION_ID, connectionOptions, - reactorProvider, handlerProvider, tokenManagerProvider, messageSerializer); + final EventHubReactorAmqpConnection connection = new EventHubReactorAmqpConnection(CONNECTION_ID, + connectionOptions, reactorProvider, handlerProvider, tokenManagerProvider, messageSerializer, product, + clientVersion); // Act & Assert StepVerifier.create(connection.getManagementNode()) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java index 9e38bdc0a5d1..8bf2c6c384ca 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java @@ -15,9 +15,12 @@ import com.azure.core.amqp.implementation.ReactorHandlerProvider; import com.azure.core.amqp.implementation.ReactorProvider; import com.azure.core.credential.TokenCredential; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.IntegrationTestBase; +import java.util.Map; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -35,11 +38,20 @@ public class ReactorConnectionIntegrationTest extends IntegrationTestBase { @Mock private MessageSerializer serializer; + private static String product; + private static String clientVersion; public ReactorConnectionIntegrationTest() { super(new ClientLogger(ReactorConnectionIntegrationTest.class)); } + @BeforeAll + public static void init() { + Map properties = CoreUtils.getProperties("azure-messaging-eventhubs.properties"); + product = properties.get("name"); + clientVersion = properties.get("version"); + } + @Override protected void beforeTest() { MockitoAnnotations.initMocks(this); @@ -58,7 +70,7 @@ protected void beforeTest() { ReactorProvider reactorProvider = new ReactorProvider(); ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(reactorProvider); connection = new ReactorConnection("test-connection-id", options, reactorProvider, - handlerProvider, tokenManagerProvider, serializer); + handlerProvider, tokenManagerProvider, serializer, product, clientVersion); } @Override diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 4356964d1c75..9af926b26a3a 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 1.1.0-beta.1 (Unreleased) + ## 1.0.0 (2019-10-25) - November 2019 SDK Release **Breaking changes** diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index 6abb6b046942..212d1a5e3d31 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -45,7 +45,7 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f com.azure azure-identity - 1.0.0 + 1.1.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index 1beb626547cc..e6ca9c3ae917 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -23,7 +23,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 org.slf4j diff --git a/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md index 92b54f181fb0..de402dedd98d 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md @@ -1,4 +1,16 @@ # Release History + +## 4.0.0-beta.8 (Unreleased) + +## 4.0.0-beta.7 (2019-12-17) +- `beginDeleteCertificate` and `beginRecoverDeletedCertificate` methods now return a poll response with a status of SUCCESSFULLY_COMPLETED when service returns 403 status. +- `CertificateClient.createIssuer` and `CertificateAsyncClient.createIssuer` now require a `CertificateIssuer` with both a name and provider. +- Removed constructor overload for `CertificateIssuer(String name, String provider)` from `CertificateIssuer` model. +- Removed `AdministratorContact` constructor overloads and introduced setters for all parameters. +- Removed `CertificateContact` constructor overloads and introduced setters for all parameters. + +For details on the Azure SDK for Java (December 2019 beta) release refer to the [release announcement](https://aka.ms/azure-sdk-beta7-java). + ## 4.0.0-beta.6 (2019-12-04) For details on the Azure SDK for Java (November 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview5-java). diff --git a/sdk/keyvault/azure-security-keyvault-certificates/README.md b/sdk/keyvault/azure-security-keyvault-certificates/README.md index a6fabbb864a5..c9c31207bcce 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/README.md +++ b/sdk/keyvault/azure-security-keyvault-certificates/README.md @@ -15,7 +15,7 @@ Maven dependency for Azure Key Client library. Add it to your project's pom file com.azure azure-security-keyvault-certificates - 4.0.0-beta.6 + 4.0.0-beta.8 ``` [//]: # ({x-version-update-end}) @@ -34,7 +34,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-security-keyvault-certificates - 4.0.0-beta.6 + 4.0.0-beta.8 com.azure @@ -50,7 +50,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-core-http-okhttp - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml index 94a553bdedf5..8105e9ca71f8 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml @@ -12,7 +12,7 @@ com.azure azure-security-keyvault-certificates - 4.0.0-beta.7 + 4.0.0-beta.8 Microsoft Azure client library for KeyVault Certificates This module contains client library for Microsoft Azure KeyVault Certificates. @@ -36,7 +36,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 @@ -84,7 +84,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java index b407cd8f0951..037b6a099e08 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java @@ -116,7 +116,7 @@ public String getVaultUrl() { * @throws ResourceModifiedException when invalid certificate policy configuration is provided. * @return A {@link PollerFlux} polling on the create certificate operation status. */ - public PollerFlux beginCreateCertificate(String certificateName, CertificatePolicy policy, boolean isEnabled, Map tags) { + public PollerFlux beginCreateCertificate(String certificateName, CertificatePolicy policy, Boolean isEnabled, Map tags) { return new PollerFlux<>(Duration.ofSeconds(1), activationOperation(certificateName, policy, isEnabled, tags), createPollOperation(certificateName), @@ -353,16 +353,16 @@ public Mono getCertificateVersion(String certificateName, S * * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateProperties#CertificateProperties} * - * @param certificateProperties The {@link CertificateProperties} object with updated properties. + * @param properties The {@link CertificateProperties} object with updated properties. * @throws NullPointerException if {@code certificate} is {@code null}. * @throws ResourceNotFoundException when a certificate with {@link CertificateProperties#getName() name} and {@link CertificateProperties#getVersion() version} doesn't exist in the key vault. * @throws HttpResponseException if {@link CertificateProperties#getName() name} or {@link CertificateProperties#getVersion() version} is empty string. * @return A {@link Mono} containing the {@link CertificateProperties updated certificate}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateProperties(CertificateProperties certificateProperties) { + public Mono updateCertificateProperties(CertificateProperties properties) { try { - return withContext(context -> updateCertificatePropertiesWithResponse(certificateProperties, context)).flatMap(FluxUtil::toMono); + return withContext(context -> updateCertificatePropertiesWithResponse(properties, context)).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -378,30 +378,30 @@ public Mono updateCertificateProperties(CertificateProperti * * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePropertiesWithResponse#CertificateProperties} * - * @param certificateProperties The {@link CertificateProperties} object with updated properties. - * @throws NullPointerException if {@code certificateProperties} is {@code null}. + * @param properties The {@link CertificateProperties} object with updated properties. + * @throws NullPointerException if {@code properties} is {@code null}. * @throws ResourceNotFoundException when a certificate with {@link CertificateProperties#getName() name} and {@link CertificateProperties#getVersion() version} doesn't exist in the key vault. * @throws HttpResponseException if {@link CertificateProperties#getName() name} or {@link CertificateProperties#getVersion() version} is empty string. * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateProperties updated certificate}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificatePropertiesWithResponse(CertificateProperties certificateProperties) { + public Mono> updateCertificatePropertiesWithResponse(CertificateProperties properties) { try { - return withContext(context -> updateCertificatePropertiesWithResponse(certificateProperties, context)); + return withContext(context -> updateCertificatePropertiesWithResponse(properties, context)); } catch (RuntimeException ex) { return monoError(logger, ex); } } - Mono> updateCertificatePropertiesWithResponse(CertificateProperties certificateProperties, Context context) { - Objects.requireNonNull(certificateProperties, "certificateProperties' cannot be null."); + Mono> updateCertificatePropertiesWithResponse(CertificateProperties properties, Context context) { + Objects.requireNonNull(properties, "properties' cannot be null."); CertificateUpdateParameters parameters = new CertificateUpdateParameters() - .tags(certificateProperties.getTags()) - .certificateAttributes(new CertificateRequestAttributes(certificateProperties)); - return service.updateCertificate(vaultUrl, certificateProperties.getName(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Updating certificate - {}", certificateProperties.getName())) - .doOnSuccess(response -> logger.info("Updated the certificate - {}", certificateProperties.getName())) - .doOnError(error -> logger.warning("Failed to update the certificate - {}", certificateProperties.getName(), error)); + .tags(properties.getTags()) + .certificateAttributes(new CertificateRequestAttributes(properties)); + return service.updateCertificate(vaultUrl, properties.getName(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating certificate - {}", properties.getName())) + .doOnSuccess(response -> logger.info("Updated the certificate - {}", properties.getName())) + .doOnError(error -> logger.warning("Failed to update the certificate - {}", properties.getName(), error)); } /** @@ -445,6 +445,10 @@ private Function, Mono Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } + if (deletedCertificateResponse.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN) { + return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, + pollingContext.getLatestResponse().getValue()))); + } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, deletedCertificateResponse.getValue()))); })) // This means either vault has soft-delete disabled or permission is not granted for the get deleted certificate operation. @@ -602,7 +606,7 @@ private Function, Mono, Mono>> createRecoverPollOperation(String keyName) { return pollingContext -> @@ -612,6 +616,10 @@ private Function, Mono Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } + if (certificateResponse.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN) { + return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, + pollingContext.getLatestResponse().getValue()))); + } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, certificateResponse.getValue()))); })) @@ -754,7 +762,7 @@ Mono> restoreCertificateBackupWithRespon * @return A {@link PagedFlux} containing {@link CertificateProperties certificate} for all the certificates in the vault. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listPropertiesOfCertificates(Boolean includePending) { + public PagedFlux listPropertiesOfCertificates(boolean includePending) { try { return new PagedFlux<>(() -> withContext(context -> listCertificatesFirstPage(includePending, context)), continuationToken -> withContext(context -> listCertificatesNextPage(continuationToken, context))); @@ -786,7 +794,7 @@ public PagedFlux listPropertiesOfCertificates() { } } - PagedFlux listPropertiesOfCertificates(Boolean includePending, Context context) { + PagedFlux listPropertiesOfCertificates(boolean includePending, Context context) { return new PagedFlux<>( () -> listCertificatesFirstPage(includePending, context), continuationToken -> listCertificatesNextPage(continuationToken, context)); @@ -813,7 +821,7 @@ private Mono> listCertificatesNextPage(Stri /* * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. */ - private Mono> listCertificatesFirstPage(Boolean includePending, Context context) { + private Mono> listCertificatesFirstPage(boolean includePending, Context context) { try { return service .getCertificates(vaultUrl, DEFAULT_MAX_PAGE_RESULTS, includePending, API_VERSION, ACCEPT_LANGUAGE, @@ -867,7 +875,7 @@ public PagedFlux listDeletedCertificates() { * @return A {@link PagedFlux} containing all of the {@link DeletedCertificate deleted certificates} in the vault. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listDeletedCertificates(Boolean includePending) { + public PagedFlux listDeletedCertificates(boolean includePending) { try { return new PagedFlux<>( () -> withContext(context -> listDeletedCertificatesFirstPage(includePending, context)), @@ -909,7 +917,7 @@ private Mono> listDeletedCertificatesNextPage( /* * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. */ - private Mono> listDeletedCertificatesFirstPage(Boolean includePending, Context context) { + private Mono> listDeletedCertificatesFirstPage(boolean includePending, Context context) { try { return service.getDeletedCertificates(vaultUrl, DEFAULT_MAX_PAGE_RESULTS, includePending, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing deleted certificates")) @@ -1150,40 +1158,6 @@ Mono> updateCertificatePolicyWithResponse(String cer .doOnError(error -> logger.warning("Failed to update the certificate policy - {}", certificateName, error)); } - /** - * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it - * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. - * - *

Code Samples

- *

Creates a new certificate issuer in the key vault. Prints out the created certificate - * issuer details when a response has been received.

- * - * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createIssuer#String-String} - * - * @param issuerName The name of the certificate issuer to be created. - * @param provider The provider of the certificate issuer to be created. - * @throws ResourceModifiedException when invalid certificate issuer {@code issuerName} or {@code provider} configuration is provided. - * @throws HttpResponseException when a certificate issuer with {@code issuerName} is empty string. - * @return A {@link Mono} containing the created {@link CertificateIssuer certificate issuer}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createIssuer(String issuerName, String provider) { - try { - return withContext(context -> createIssuerWithResponse(issuerName, provider, context)).flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - Mono> createIssuerWithResponse(String issuerName, String provider, Context context) { - CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters() - .provider(provider); - return service.setCertificateIssuer(vaultUrl, API_VERSION, ACCEPT_LANGUAGE, issuerName, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Creating certificate issuer - {}", issuerName)) - .doOnSuccess(response -> logger.info("Created the certificate issuer - {}", response.getValue().getName())) - .doOnError(error -> logger.warning("Failed to create the certificate issuer - {}", issuerName, error)); - } - /** * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. @@ -1218,7 +1192,8 @@ public Mono createIssuer(CertificateIssuer issuer) { * * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createIssuerWithResponse#CertificateIssuer} * - * @param issuer The configuration of the certificate issuer to be created. + * @param issuer The configuration of the certificate issuer to be created. Use + * {@link CertificateIssuer#CertificateIssuer(String, String)} to initialize the issuer object * @throws ResourceModifiedException when invalid certificate issuer {@code issuer} configuration is provided. * @throws HttpResponseException when a certificate issuer with {@link CertificateIssuer#getName() name} is empty string. * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the created {@link CertificateIssuer certificate issuer}. @@ -1244,7 +1219,6 @@ Mono> createIssuerWithResponse(CertificateIssuer iss .doOnError(error -> logger.warning("Failed to create the certificate issuer - {}", issuer.getName(), error)); } - /** * Retrieves the specified certificate issuer from the key vault. This operation requires the certificates/manageissuers/getissuers permission. * @@ -1422,7 +1396,8 @@ private Mono> listPropertiesOfIssuersNextPage(St * * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateIssuer#CertificateIssuer} * - * @param issuer The {@link CertificateIssuer issuer} with updated properties. + * @param issuer The {@link CertificateIssuer issuer} with updated properties. Use + * {@link CertificateIssuer#CertificateIssuer(String)} to initialize the issuer object * @throws NullPointerException if {@code issuer} is {@code null}. * @throws ResourceNotFoundException when a certificate issuer with {@link CertificateIssuer#getName() name} doesn't exist in the key vault. * @throws HttpResponseException if {@link CertificateIssuer#getName() name} is empty string. @@ -1643,6 +1618,52 @@ Mono> cancelCertificateOperationWithResponse(Stri .doOnError(error -> logger.warning("Failed to cancel the certificate operation - {}", certificateName, error)); } + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperation#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpResponseException when the {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelCertificateOperation(String certificateName) { + try { + return withContext(context -> cancelCertificateOperationWithResponse(certificateName, context)).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperationWithResponse#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpResponseException when the {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelCertificateOperationWithResponse(String certificateName) { + try { + return withContext(context -> cancelCertificateOperationWithResponse(certificateName, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + /** * Imports a pre-existing certificate to the key vault. The specified certificate must be in PFX or PEM format, * and must contain the private key as well as the x509 certificates. This operation requires the {@code certificates/import} permission. @@ -1691,7 +1712,7 @@ Mono> importCertificateWithResponse(Impo CertificateImportParameters parameters = new CertificateImportParameters() .base64EncodedCertificate(Base64.getEncoder().encodeToString(importCertificateOptions.getCertificate())) .certificateAttributes(new CertificateRequestAttributes(importCertificateOptions)) - .certificatePolicy(importCertificateOptions.getCertificatePolicy()) + .certificatePolicy(importCertificateOptions.getPolicy()) .password(importCertificateOptions.getPassword()) .tags(importCertificateOptions.getTags()); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java index 04738662b0d6..c1c4aa9bbe22 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java @@ -146,7 +146,7 @@ public SyncPoller getCertif */ @ServiceMethod(returns = ReturnType.SINGLE) public KeyVaultCertificateWithPolicy getCertificate(String certificateName) { - return client.getCertificate(certificateName).block(); + return getCertificateWithResponse(certificateName, Context.NONE).getValue(); } /** @@ -155,18 +155,19 @@ public KeyVaultCertificateWithPolicy getCertificate(String certificateName) { *

Code Samples

*

Gets a specific version of the certificate in the key vault. Prints out the returned certificate details when a response has been received.

* - * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String} + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String-Context} * * @param certificateName The name of the certificate to retrieve, cannot be null + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws ResourceNotFoundException when a certificate with {@code certificateName} doesn't exist in the key vault. * @throws HttpRequestException if {@code certificateName} is empty string. * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link KeyVaultCertificateWithPolicy certificate}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCertificateWithResponse(String certificateName) { - return client.getCertificateWithResponse(certificateName).block(); + public Response getCertificateWithResponse(String certificateName, Context context) { + return client.getCertificateWithResponse(certificateName, "", context).block(); } - + /** * Gets information about the latest version of the specified certificate. This operation requires the certificates/get permission. * @@ -216,15 +217,15 @@ public KeyVaultCertificate getCertificateVersion(String certificateName, String * * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificateProperties#CertificateProperties} * - * @param certificateProperties The {@link CertificateProperties} object with updated properties. + * @param properties The {@link CertificateProperties} object with updated properties. * @throws NullPointerException if {@code certificate} is {@code null}. * @throws ResourceNotFoundException when a certificate with {@link CertificateProperties#getName() certificateName} and {@link CertificateProperties#getVersion() version} doesn't exist in the key vault. * @throws HttpRequestException if {@link CertificateProperties#getName() certificateName} or {@link CertificateProperties#getVersion() version} is empty string. * @return The {@link CertificateProperties updated certificate}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public KeyVaultCertificate updateCertificateProperties(CertificateProperties certificateProperties) { - return updateCertificatePropertiesWithResponse(certificateProperties, Context.NONE).getValue(); + public KeyVaultCertificate updateCertificateProperties(CertificateProperties properties) { + return updateCertificatePropertiesWithResponse(properties, Context.NONE).getValue(); } /** @@ -237,7 +238,7 @@ public KeyVaultCertificate updateCertificateProperties(CertificateProperties cer * * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePropertiesWithResponse#CertificateProperties-Context} * - * @param certificateProperties The {@link CertificateProperties} object with updated properties. + * @param properties The {@link CertificateProperties} object with updated properties. * @param context Additional context that is passed through the Http pipeline during the service call. * @throws NullPointerException if {@code certificate} is {@code null}. * @throws ResourceNotFoundException when a certificate with {@link CertificateProperties#getName() certificateName} and {@link CertificateProperties#getVersion() version} doesn't exist in the key vault. @@ -245,8 +246,8 @@ public KeyVaultCertificate updateCertificateProperties(CertificateProperties cer * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateProperties updated certificate}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateCertificatePropertiesWithResponse(CertificateProperties certificateProperties, Context context) { - return client.updateCertificatePropertiesWithResponse(certificateProperties, context).block(); + public Response updateCertificatePropertiesWithResponse(CertificateProperties properties, Context context) { + return client.updateCertificatePropertiesWithResponse(properties, context).block(); } @@ -531,7 +532,7 @@ public PagedIterable listDeletedCertificates() { * @return A {@link PagedIterable} containing all of the {@link DeletedCertificate deleted certificates} in the vault. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listDeletedCertificates(Boolean includePending, Context context) { + public PagedIterable listDeletedCertificates(boolean includePending, Context context) { return new PagedIterable<>(client.listDeletedCertificates(includePending, context)); } @@ -661,27 +662,6 @@ public Response updateCertificatePolicyWithResponse(String ce return client.updateCertificatePolicyWithResponse(certificateName, policy, context).block(); } - /** - * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it - * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. - * - *

Code Samples

- *

Creates a new certificate issuer in the key vault. Prints out the created certificate - * issuer details when a response has been received.

- * - * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createIssuer#String-String} - * - * @param issuerName The name of the certificate issuer to be created. - * @param provider The provider of the certificate issuer to be created. - * @throws ResourceModifiedException when invalid certificate issuer {@code issuerName} or {@code provider} configuration is provided. - * @throws HttpRequestException when a certificate issuer with {@code issuerName} is empty string. - * @return The created {@link CertificateIssuer certificate issuer}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateIssuer createIssuer(String issuerName, String provider) { - return createIssuerWithResponse(new CertificateIssuer(issuerName, provider), Context.NONE).getValue(); - } - /** * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. @@ -1027,6 +1007,44 @@ public CertificateOperation deleteCertificateOperation(String certificateName) { public Response deleteCertificateOperationWithResponse(String certificateName, Context context) { return client.deleteCertificateOperationWithResponse(certificateName, context).block(); } + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperation#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation cancelCertificateOperation(String certificateName) { + return cancelCertificateOperationWithResponse(certificateName, Context.NONE).getValue(); + } + + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperationWithResponse#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelCertificateOperationWithResponse(String certificateName, Context context) { + return client.cancelCertificateOperationWithResponse(certificateName, context).block(); + } /** * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java index 1ee08dbaafa9..f4d5fc76c65b 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java @@ -111,8 +111,7 @@ Mono> getCertificate(@HostParam("url") String url, Context context); @Get("certificates/{certificate-name}/{certificate-version}") - @ExpectedResponses({200, 404}) - @UnexpectedResponseExceptionType(code = {403}, value = ResourceModifiedException.class) + @ExpectedResponses({200, 404, 403}) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> getCertificatePoller(@HostParam("url") String url, @PathParam("certificate-name") String certificateName, @@ -197,7 +196,7 @@ Mono> getDeletedCertificate(@HostParam("url") Strin Context context); @Get("deletedcertificates/{certificate-name}") - @ExpectedResponses({200, 404}) + @ExpectedResponses({200, 403, 404}) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> getDeletedCertificatePoller(@HostParam("url") String url, @PathParam("certificate-name") String certificateName, @@ -431,14 +430,4 @@ Mono> updateCertificatePolicy(@HostParam("url") Stri @BodyParam("application/json") CertificatePolicyRequest certificatePolicyRequest, @HeaderParam("Content-Type") String type, Context context); - - @Get("certificates/{certificate-name}/pending") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getPendingCertificateSigningRequest(@HostParam("url") String url, - @QueryParam("api-version") String apiVersion, - @HeaderParam("accept-language") String acceptLanguage, - @PathParam("certificate-name") String certificateName, - @HeaderParam("Content-Type") String type, - Context context); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java index 394fe695b7aa..afd9c3ec8bd3 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java @@ -9,6 +9,7 @@ * Represents an administrator in {@link CertificateIssuer} */ public final class AdministratorContact { + /** * First name. */ @@ -22,7 +23,7 @@ public final class AdministratorContact { private String lastName; /** - * Email addresss. + * Email address. */ @JsonProperty(value = "email") private String email; @@ -33,32 +34,6 @@ public final class AdministratorContact { @JsonProperty(value = "phone") private String phone; - /** - * Creates an administrator of the issuer. - * @param firstName the firstName of the issuer. - * @param lastName the last name of the issuer. - * @param email the email of the issuer. - */ - public AdministratorContact(String firstName, String lastName, String email) { - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - } - - /** - * Creates an administrator of the issuer. - * @param firstName the firstName of the admin. - * @param lastName the last name of the admin. - * @param email the email of the admin. - * @param phone the contact info of the admin. - */ - public AdministratorContact(String firstName, String lastName, String email, String phone) { - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - this.phone = phone; - } - /** * Get the first name of the admin. * @return the first name of admin. @@ -90,4 +65,44 @@ public String getEmail() { public String getPhone() { return phone; } + + /** + * Set the first name of the admin. + * @param firstName the first name of the admin to set. + * @return the updated AdministratorContact object itself. + */ + public AdministratorContact setFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Set the last name of the admin. + * @param lastName the last name of the admin to set. + * @return the updated AdministratorContact object itself. + */ + public AdministratorContact setLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Set the email of the admin. + * @param email the email of the admin to set. + * @return the updated AdministratorContact object itself. + */ + public AdministratorContact setEmail(String email) { + this.email = email; + return this; + } + + /** + * Set the contact of the admin. + * @param phone the enabled status to set + * @return the updated AdministratorContact object itself. + */ + public AdministratorContact setPhone(String phone) { + this.phone = phone; + return this; + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java index 6f451a7e8edb..f2925ad9f688 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java @@ -11,7 +11,7 @@ */ public final class CertificateContact { /** - * Email addresss. + * Email address. */ @JsonProperty(value = "email") private String email; @@ -28,32 +28,6 @@ public final class CertificateContact { @JsonProperty(value = "phone") private String phone; - /** - * Creates a new certificate contact. - * - * @param name The name of the contact - * @param email The email address of the contact - * @param phone The phone number of the contact. - */ - public CertificateContact(String name, String email, String phone) { - this.name = name; - this.email = email; - this.phone = phone; - } - - /** - * Creates a new certificate contact. - * - * @param name The name of the contact - * @param email The email address of the contact - */ - public CertificateContact(String name, String email) { - this.name = name; - this.email = email; - } - - CertificateContact() { } - /** * Get the email address. * @@ -80,4 +54,34 @@ public String getName() { public String getPhone() { return this.phone; } + + /** + * Set the email of the contact. + * @param email the email of the contact to set + * @return the updated CertificateContact object itself. + */ + public CertificateContact setEmail(String email) { + this.email = email; + return this; + } + + /** + * Set the name of the contact. + * @param name the name of the contact to set + * @return the updated CertificateContact object itself. + */ + public CertificateContact setName(String name) { + this.name = name; + return this; + } + + /** + * Set the phone of the contact. + * @param phone the phone of the contact to set + * @return the updated CertificateContact object itself. + */ + public CertificateContact setPhone(String phone) { + this.phone = phone; + return this; + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java index e1852ab83907..ccf62e983d34 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java @@ -85,6 +85,15 @@ public CertificateIssuer(String name, String provider) { this.provider = provider; } + /** + * Creates an instance of the issuer. + * + * @param name The name of the issuer. + */ + public CertificateIssuer(String name) { + this.name = name; + } + CertificateIssuer() { } /** @@ -205,7 +214,7 @@ public CertificateIssuer setEnabled(Boolean enabled) { * Get the created UTC time. * @return the created UTC time. */ - public OffsetDateTime getCreated() { + public OffsetDateTime getCreatedOn() { return created; } @@ -213,7 +222,7 @@ public OffsetDateTime getCreated() { * Get the updated UTC time. * @return the updated UTC time. */ - public OffsetDateTime getUpdated() { + public OffsetDateTime getUpdatedOn() { return updated; } @@ -240,7 +249,7 @@ private List parseAdministrators(List admins) { String lastName = map.containsKey("last_name") ? map.get("last_name") : ""; String email = map.containsKey("email") ? map.get("email") : ""; String phone = map.containsKey("phone") ? map.get("phone") : ""; - output.add(new AdministratorContact(firstName, lastName, email, phone)); + output.add(new AdministratorContact().setFirstName(firstName).setLastName(lastName).setEmail(email).setPhone(phone)); } return output; } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java index 040e5d97d480..af04b11a8f9b 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java @@ -4,14 +4,30 @@ package com.azure.security.keyvault.certificates.models; import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Map; /** * A certificate operation is returned in case of long running service requests. */ public final class CertificateOperation { + + private final ClientLogger logger = new ClientLogger(CertificateOperation.class); + + /** + * URL for the Azure KeyVault service. + */ + private String vaultUrl; + + /** + * The Certificate name. + */ + private String name; + /** * The certificate id. */ @@ -177,10 +193,43 @@ public String getRequestId() { return this.requestId; } + /** + * Get the URL for the Azure KeyVault service. + * + * @return the value of the URL for the Azure KeyVault service. + */ + public String getVaultUrl() { + return this.vaultUrl; + } + + /** + * Get the certificate name. + * + * @return the name of the certificate. + */ + public String getName() { + return this.name; + } + @JsonProperty("issuer") private void unpackIssuerParameters(Map issuerParameters) { issuerName = (String) issuerParameters.get("name"); certificateType = (String) issuerParameters.get("cty"); certificateTransparency = issuerParameters.get("cert_transparency") != null ? (Boolean) issuerParameters.get("cert_transparency") : false; } + + @JsonProperty(value = "id") + void unpackId(String id) { + if (id != null && id.length() > 0) { + this.id = id; + try { + URL url = new URL(id); + String[] tokens = url.getPath().split("/"); + this.vaultUrl = (tokens.length >= 2 ? tokens[1] : null); + this.name = (tokens.length >= 3 ? tokens[2] : null); + } catch (MalformedURLException e) { + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Key Vault endpoint url is malformed.", e)); + } + } + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java index 132d13a0b4f7..9367212c38b0 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java @@ -340,17 +340,6 @@ public CertificatePolicy setContentType(CertificateContentType contentType) { return this; } - /** - * Set the subject value. - * - * @param subjectName the subject value to set - * @return the updated CertificatePolicy object itself. - */ - public CertificatePolicy getSubjectName(String subjectName) { - this.subject = subjectName; - return this; - } - /** * Get the subjectAlternativeNames. * @@ -371,6 +360,17 @@ public CertificatePolicy setSubjectAlternativeNames(SubjectAlternativeNames subj return this; } + /** + * Set the subject Name. + * + * @param subject the subject Name to set + * @return the updated CertificatePolicy object itself. + */ + public CertificatePolicy setSubject(final String subject) { + this.subject = subject; + return this; + } + /** * Set the validity in months. * @@ -404,17 +404,6 @@ public CertificatePolicy setKeyCurveName(CertificateKeyCurveName keyCurveName) { return this; } - /** - * Set the issuer name. - * - * @param issuerName the issuer name to set - * @return the updated CertificatePolicy object itself. - */ - public CertificatePolicy setIssuerName(String issuerName) { - this.issuerName = issuerName; - return this; - } - /** * Set the certificate type to request from the issuer. * diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java index 8a2e33e2f811..00207d00fa84 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates.models; import com.azure.core.util.Base64Url; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; import java.net.MalformedURLException; import java.net.URL; @@ -17,6 +18,13 @@ */ public class CertificateProperties { + private final ClientLogger logger = new ClientLogger(CertificateProperties.class); + + /** + * URL for the Azure KeyVault service. + */ + private String vaultUrl; + /** * Determines whether the object is enabled. */ @@ -141,6 +149,15 @@ public Map getTags() { return this.tags; } + /** + * Get the URL for the Azure KeyVault service. + * + * @return the value of the URL for the Azure KeyVault service. + */ + public String getVaultUrl() { + return this.vaultUrl; + } + /** * Set the tags to be associated with the certificate. * @@ -237,10 +254,11 @@ void unpackId(String id) { try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); + this.vaultUrl = (tokens.length >= 2 ? tokens[1] : null); this.name = (tokens.length >= 3 ? tokens[2] : null); this.version = (tokens.length >= 4 ? tokens[3] : null); } catch (MalformedURLException e) { - e.printStackTrace(); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Key Vault endpoint url is malformed.", e)); } } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java index 8d6f560ad21d..965b7c175126 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java @@ -20,7 +20,7 @@ * @see CertificateAsyncClient * @see CertificateClient */ -public final class DeletedCertificate extends KeyVaultCertificate { +public final class DeletedCertificate extends KeyVaultCertificateWithPolicy { /** * The url of the recovery object, used to identify and recover the deleted diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/ImportCertificateOptions.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/ImportCertificateOptions.java index 814a32639495..d4124a768872 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/ImportCertificateOptions.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/ImportCertificateOptions.java @@ -37,7 +37,7 @@ public final class ImportCertificateOptions { /** * The policy which governs the lifecycle of the imported certificate and it's properties when it is rotated. */ - private CertificatePolicy certificatePolicy; + private CertificatePolicy policy; /** * Application specific metadata in the form of key-value pairs. @@ -78,17 +78,17 @@ public Boolean isEnabled() { * Get the management policy for the certificate. * @return the management policy */ - public CertificatePolicy getCertificatePolicy() { - return this.certificatePolicy; + public CertificatePolicy getPolicy() { + return this.policy; } /** * Set the management policy for the certificate. - * @param certificatePolicy the management policy for the certificate + * @param policy the management policy for the certificate * @return the updated CertificateImportOptions itself */ - public ImportCertificateOptions setCertificatePolicy(CertificatePolicy certificatePolicy) { - this.certificatePolicy = certificatePolicy; + public ImportCertificateOptions setPolicy(CertificatePolicy policy) { + this.policy = policy; return this; } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerProperties.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerProperties.java index 532ba54d9db8..a714f9481b96 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerProperties.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerProperties.java @@ -31,19 +31,6 @@ public class IssuerProperties { @JsonProperty(value = "name") String name; - /** - * Creates a new IssuerProperties instance. - * - * @param name Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. - * @param provider The issuer provider. - */ - IssuerProperties(String name, String provider) { - this.name = name; - this.provider = provider; - } - - IssuerProperties() { } - /** * Get the id of the issuer. * @return the identifier. @@ -68,6 +55,16 @@ public String getName() { return name; } + /** + * Set the issuer provider + * @param provider The issuer provider. + * @return the updated IssuerProperties object + */ + public IssuerProperties setProvider(String provider) { + this.provider = provider; + return this; + } + @JsonProperty(value = "id") void unpackId(String id) { if (id != null && id.length() > 0) { diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyVaultCertificateWithPolicy.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyVaultCertificateWithPolicy.java index 78707df5abde..25cfbb159e1d 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyVaultCertificateWithPolicy.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyVaultCertificateWithPolicy.java @@ -8,13 +8,13 @@ /** * Represents a certificate with all of its properties including {@link CertificatePolicy}. */ -public final class KeyVaultCertificateWithPolicy extends KeyVaultCertificate { +public class KeyVaultCertificateWithPolicy extends KeyVaultCertificate { /** * The Certificate policy. */ @JsonProperty("policy") - private CertificatePolicy certificatePolicy; + private CertificatePolicy policy; /** * Create the certificate @@ -43,8 +43,8 @@ public KeyVaultCertificateWithPolicy setProperties(CertificateProperties propert * Get the certificate policy of the certificate * @return the cer content. */ - public CertificatePolicy getCertificatePolicy() { - return this.certificatePolicy; + public CertificatePolicy getPolicy() { + return this.policy; } /** @@ -53,8 +53,8 @@ public CertificatePolicy getCertificatePolicy() { * @param certificatePolicy the policy to set. * @return the certificateWithPolicy object itself. */ - public KeyVaultCertificateWithPolicy setCertificatePolicy(CertificatePolicy certificatePolicy) { - this.certificatePolicy = certificatePolicy; + public KeyVaultCertificateWithPolicy setPolicy(CertificatePolicy certificatePolicy) { + this.policy = certificatePolicy; return this; } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java index 1e34f346cbcd..5b5177d0ce4c 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java @@ -14,7 +14,7 @@ public final class MergeCertificateOptions { /** * The name of the certificate. */ - private final String certificateName; + private final String name; /** * The certificate or the certificate chain to merge. @@ -34,11 +34,11 @@ public final class MergeCertificateOptions { /** * Creates a new MergeCertificationOptions instance. * - * @param certificateName The name of the certificate. + * @param name The name of the certificate. * @param x509Certificates The certificate or the certificate chain to merge. */ - public MergeCertificateOptions(String certificateName, List x509Certificates) { - this.certificateName = certificateName; + public MergeCertificateOptions(String name, List x509Certificates) { + this.name = name; this.x509Certificates = x509Certificates; } @@ -87,7 +87,7 @@ public Boolean isEnabled() { * @return the certificate name. */ public String getName() { - return this.certificateName; + return this.name; } /** diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java index e042f6eae6d7..3b5c530b1339 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java @@ -73,7 +73,7 @@ public static void main(String[] args) throws IOException, InterruptedException, certificateClient.beginDeleteCertificate("certificateName"); // Deleted Certificate is accessible as soon as polling beings. PollResponse pollResponse = deletedCertificatePoller.poll(); - System.out.printf("Deleted certitifcate with name %s and recovery id %s", pollResponse.getValue().getName(), + System.out.printf("Deleted certificate with name %s and recovery id %s", pollResponse.getValue().getName(), pollResponse.getValue().getRecoveryId()); deletedCertificatePoller.waitForCompletion(); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java index c7f949c593e5..326f10de0b21 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java @@ -205,19 +205,10 @@ public void getCertificateOperation() { } /** - * Method to insert code snippets for {@link CertificateAsyncClient#createIssuer(String, String)} + * Method to insert code snippets for {@link CertificateAsyncClient#createIssuer(CertificateIssuer)} */ public void createCertificateIssuerCodeSnippets() { CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); - // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createIssuer#String-String - certificateAsyncClient.createIssuer("issuerName", "providerName") - .subscriberContext(Context.of(key1, value1, key2, value2)) - .subscribe(issuer -> { - System.out.printf("Issuer created with %s and %s", issuer.getName(), - issuer.getProvider()); - }); - // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.createIssuer#String-String - // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createIssuer#CertificateIssuer CertificateIssuer issuer = new CertificateIssuer("issuerName", "providerName") .setAccountId("keyvaultuser") @@ -579,8 +570,8 @@ public void listCertificateVersionsCodeSnippets() { public void contactsOperationsCodeSnippets() { CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.setContacts#contacts - CertificateContact oontactToAdd = new CertificateContact("user", "useremail@exmaple.com"); - certificateAsyncClient.setContacts(Arrays.asList(oontactToAdd)).subscribe(contact -> + CertificateContact contactToAdd = new CertificateContact().setName("user").setEmail("useremail@exmaple.com"); + certificateAsyncClient.setContacts(Arrays.asList(contactToAdd)).subscribe(contact -> System.out.printf("Contact name %s and email %s", contact.getName(), contact.getEmail()) ); // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.setContacts#contacts @@ -615,6 +606,18 @@ public void certificateOperationCodeSnippets() { .subscribe(certificateOperation -> System.out.printf("Deleted Certificate operation last status %s", certificateOperation.getStatus())); // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperation#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperation#string + certificateAsyncClient.cancelCertificateOperation("certificateName") + .subscribe(certificateOperation -> System.out.printf("Certificate operation status %s", + certificateOperation.getStatus())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperation#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperationWithResponse#string + certificateAsyncClient.cancelCertificateOperationWithResponse("certificateName") + .subscribe(certificateOperationResponse -> System.out.printf("Certificate operation status %s", + certificateOperationResponse.getValue().getStatus())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperationWithResponse#string } /** diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java index c129d47dc6de..409540d0cc74 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java @@ -82,24 +82,24 @@ public void getCertificateWithResponseCodeSnippets() { CertificateClient certificateClient = getCertificateClient(); // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificate#String KeyVaultCertificateWithPolicy certificate = certificateClient.getCertificate("certificateName"); - System.out.printf("Recevied certificate with name %s and version %s and secret id", + System.out.printf("Received certificate with name %s and version %s and secret id", certificate.getProperties().getName(), certificate.getProperties().getVersion(), certificate.getSecretId()); // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificate#String - // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String-Context Response certificateWithResponse = certificateClient - .getCertificateWithResponse("certificateName"); - System.out.printf("Recevied certificate with name %s and version %s and secret id", + .getCertificateWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Received certificate with name %s and version %s and secret id", certificateWithResponse.getValue().getProperties().getName(), certificateWithResponse.getValue().getProperties().getVersion(), certificate.getSecretId()); - // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String-Context // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateVersionWithResponse#String-String-Context Response returnedCertificateWithResponse = certificateClient .getCertificateVersionWithResponse("certificateName", "certificateVersion", new Context(key1, value1)); - System.out.printf("Recevied certificate with name %s and version %s and secret id", + System.out.printf("Received certificate with name %s and version %s and secret id", returnedCertificateWithResponse.getValue().getProperties().getName(), returnedCertificateWithResponse.getValue().getProperties().getVersion(), returnedCertificateWithResponse.getValue().getSecretId()); @@ -108,7 +108,7 @@ public void getCertificateWithResponseCodeSnippets() { // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateVersion#String-String KeyVaultCertificate returnedCertificate = certificateClient.getCertificateVersion("certificateName", "certificateVersion"); - System.out.printf("Recevied certificate with name %s and version %s and secret id", + System.out.printf("Received certificate with name %s and version %s and secret id", returnedCertificate.getProperties().getName(), returnedCertificate.getProperties().getVersion(), returnedCertificate.getSecretId()); // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateVersion#String-String @@ -163,21 +163,15 @@ public void getCertificateOperation() { /** - * Method to insert code snippets for {@link CertificateClient#createIssuer(String, String)} + * Method to insert code snippets for {@link CertificateClient#createIssuer(CertificateIssuer)} */ public void createCertificateIssuerCodeSnippets() { CertificateClient certificateClient = getCertificateClient(); - // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createIssuer#String-String - CertificateIssuer createdIssuer = certificateClient.createIssuer("myIssuer", "myProvider"); - System.out.printf("Created Issuer with name %s provider %s", createdIssuer.getName(), - createdIssuer.getProvider()); - // END: com.azure.security.keyvault.certificates.CertificateClient.createIssuer#String-String - // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createIssuer#CertificateIssuer CertificateIssuer issuerToCreate = new CertificateIssuer("myissuer", "myProvider") .setAccountId("testAccount") - .setAdministratorContacts(Arrays.asList(new AdministratorContact("test", "name", - "test@example.com"))); + .setAdministratorContacts(Arrays.asList(new AdministratorContact().setFirstName("test").setLastName("name") + .setEmail("test@example.com"))); CertificateIssuer returnedIssuer = certificateClient.createIssuer(issuerToCreate); System.out.printf("Created Issuer with name %s provider %s", returnedIssuer.getName(), returnedIssuer.getProvider()); @@ -186,8 +180,8 @@ public void createCertificateIssuerCodeSnippets() { // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createIssuerWithResponse#CertificateIssuer-Context CertificateIssuer issuer = new CertificateIssuer("issuerName", "myProvider") .setAccountId("testAccount") - .setAdministratorContacts(Arrays.asList(new AdministratorContact("test", "name", - "test@example.com"))); + .setAdministratorContacts(Arrays.asList(new AdministratorContact().setFirstName("test").setLastName("name") + .setEmail("test@example.com"))); Response issuerResponse = certificateClient.createIssuerWithResponse(issuer, new Context(key1, value1)); System.out.printf("Created Issuer with name %s provider %s", issuerResponse.getValue().getName(), @@ -529,7 +523,7 @@ public void listCertificateVersionsCodeSnippets() { public void contactsOperationsCodeSnippets() { CertificateClient certificateClient = getCertificateClient(); // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.setContacts#contacts - CertificateContact contactToAdd = new CertificateContact("user", "useremail@exmaple.com"); + CertificateContact contactToAdd = new CertificateContact().setName("user").setEmail("useremail@exmaple.com"); for (CertificateContact contact : certificateClient.setContacts(Arrays.asList(contactToAdd))) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), contact.getEmail()); @@ -537,7 +531,7 @@ public void contactsOperationsCodeSnippets() { // END: com.azure.security.keyvault.certificates.CertificateClient.setContacts#contacts // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.setContacts#contacts-context - CertificateContact sampleContact = new CertificateContact("user", "useremail@exmaple.com"); + CertificateContact sampleContact = new CertificateContact().setName("user").setEmail("useremail@exmaple.com"); for (CertificateContact contact : certificateClient.setContacts(Arrays.asList(sampleContact), new Context(key1, value1))) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), @@ -592,6 +586,18 @@ public void certificateOperationCodeSnippets() { System.out.printf("Deleted Certificate Operation's last status %s", deletedCertificateOperationWithResponse.getValue().getStatus()); // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperation#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperation#string + CertificateOperation certificateOperation = certificateClient + .cancelCertificateOperation("certificateName"); + System.out.printf("Certificate Operation status %s", certificateOperation.getStatus()); + // END: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperation#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperationWithResponse#string + Response certificateOperationWithResponse = certificateClient + .cancelCertificateOperationWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Certificate Operation status %s", certificateOperationWithResponse.getValue().getStatus()); + // END: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperationWithResponse#string } /** diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java index 14ccdbf6d612..185642f7774a 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java @@ -96,7 +96,7 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum certificateClient.beginDeleteCertificate("certificateName"); // Deleted Certificate is accessible as soon as polling beings. PollResponse pollResponse = deletedCertificatePoller.poll(); - System.out.printf("Deleted certitifcate with name %s and recovery id %s", pollResponse.getValue().getName(), + System.out.printf("Deleted certificate with name %s and recovery id %s", pollResponse.getValue().getName(), pollResponse.getValue().getRecoveryId()); deletedCertificatePoller.waitForCompletion(); @@ -104,7 +104,7 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum certificateClient.beginDeleteCertificate("myCertificate"); // Deleted Certificate is accessible as soon as polling beings. PollResponse deletePollResponse = deletedCertPoller.poll(); - System.out.printf("Deleted certitifcate with name %s and recovery id %s", deletePollResponse.getValue().getName(), + System.out.printf("Deleted certificate with name %s and recovery id %s", deletePollResponse.getValue().getName(), deletePollResponse.getValue().getRecoveryId()); deletedCertificatePoller.waitForCompletion(); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java index 7d8bf7e6a430..5acf87714ac6 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates; import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificateIssuer; import com.azure.security.keyvault.certificates.models.CertificatePolicy; import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; import com.azure.security.keyvault.certificates.models.KeyVaultCertificate; @@ -78,7 +79,7 @@ public static void main(String[] args) throws InterruptedException { //Let's create a certificate issuer. - certificateAsyncClient.createIssuer("myIssuer", "Test") + certificateAsyncClient.createIssuer(new CertificateIssuer("myIssuer", "Test")) .subscribe(issuer -> { System.out.printf("Issuer created with %s and %s", issuer.getName(), issuer.getProvider()); }); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java index 11ac31ef6c52..48cfc5aa3090 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java @@ -88,7 +88,7 @@ public static void main(String[] args) throws IllegalArgumentException { } // Let's set certificate contacts on the Key vault. - CertificateContact contactToAdd = new CertificateContact("user", "useremail@exmaple.com"); + CertificateContact contactToAdd = new CertificateContact().setName("user").setEmail("useremail@exmaple.com"); for (CertificateContact contact : certificateClient.setContacts(Arrays.asList(contactToAdd))) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), contact.getEmail()); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java index aa4e2529ba92..8091c5713a4e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates; import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificateIssuer; import com.azure.security.keyvault.certificates.models.CertificatePolicy; import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; import com.azure.security.keyvault.certificates.models.CertificateKeyCurveName; @@ -54,7 +55,7 @@ public static void main(String[] args) throws InterruptedException { Thread.sleep(22000); //Let's create a certificate issuer. - certificateAsyncClient.createIssuer("myIssuer", "Test") + certificateAsyncClient.createIssuer(new CertificateIssuer("myIssuer", "Test")) .subscribe(issuer -> { System.out.printf("Issuer created with %s and %s\n", issuer.getName(), issuer.getProvider()); }); @@ -74,8 +75,8 @@ public static void main(String[] args) throws InterruptedException { // Let's list all the certificates in the key vault. certificateAsyncClient.listPropertiesOfCertificates() - .subscribe(certificateProeprties -> certificateAsyncClient - .getCertificateVersion(certificateProeprties.getName(), certificateProeprties.getVersion()) + .subscribe(certificateProperties -> certificateAsyncClient + .getCertificateVersion(certificateProperties.getName(), certificateProperties.getVersion()) .subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s \n", certificateResponse.getProperties().getName(), certificateResponse.getKeyId()))); @@ -99,7 +100,7 @@ public static void main(String[] args) throws InterruptedException { Thread.sleep(5000); // Let's set certificate contacts on the Key vault. - CertificateContact oontactToAdd = new CertificateContact("user", "useremail@exmaple.com"); + CertificateContact oontactToAdd = new CertificateContact().setName("user").setEmail("useremail@exmaple.com"); certificateAsyncClient.setContacts(Arrays.asList(oontactToAdd)).subscribe(contact -> System.out.printf("Contact name %s and email %s\n", contact.getName(), contact.getEmail()) ); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java index 4a53663a9064..80d63c24ad8e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java @@ -86,7 +86,7 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup deletedCertificatePoller = certificateClient.beginDeleteCertificate("certificateName"); // Deleted Certificate is accessible as soon as polling beings. PollResponse deletePollResponse = deletedCertificatePoller.poll(); - System.out.printf("Deleted certitifcate with name %s and recovery id %s", deletePollResponse.getValue().getName(), + System.out.printf("Deleted certificate with name %s and recovery id %s", deletePollResponse.getValue().getName(), deletePollResponse.getValue().getRecoveryId()); deletedCertificatePoller.waitForCompletion(); //To ensure certificate is deleted on server side. diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java index 6544914b2024..1bb8eebdb8e0 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java @@ -126,7 +126,7 @@ public void getCertificate() { certPoller.waitForCompletion(); KeyVaultCertificateWithPolicy certificate = certPoller.getFinalResult(); KeyVaultCertificateWithPolicy getCertificate = client.getCertificate(certificateName); - validatePolicy(certificate.getCertificatePolicy(), getCertificate.getCertificatePolicy()); + validatePolicy(certificate.getPolicy(), getCertificate.getPolicy()); deleteAndPurgeCertificate(certificateName); }); } @@ -271,7 +271,7 @@ public void restoreCertificate() { sleepInRecordMode(40000); KeyVaultCertificateWithPolicy restoredCertificate = client.restoreCertificateBackup(backupBytes); assertEquals(certificateName, restoredCertificate.getName()); - validatePolicy(restoredCertificate.getCertificatePolicy(), createdCert.getCertificatePolicy()); + validatePolicy(restoredCertificate.getPolicy(), createdCert.getPolicy()); deleteAndPurgeCertificate(certificateName); }); } @@ -287,8 +287,8 @@ public void getCertificateOperation() { KeyVaultCertificateWithPolicy reteievedCert = retrievePoller.getFinalResult(); KeyVaultCertificateWithPolicy expectedCert = certPoller.getFinalResult(); validateCertificate(expectedCert, reteievedCert); - validatePolicy(expectedCert.getCertificatePolicy(), - reteievedCert.getCertificatePolicy()); + validatePolicy(expectedCert.getPolicy(), + reteievedCert.getPolicy()); deleteAndPurgeCertificate(certName); }); } @@ -325,7 +325,7 @@ public void getCertificatePolicy() { client.beginCreateCertificate(certName, setupPolicy()); certPoller.waitForCompletion(); KeyVaultCertificateWithPolicy certificate = certPoller.getFinalResult(); - validatePolicy(setupPolicy(), certificate.getCertificatePolicy()); + validatePolicy(setupPolicy(), certificate.getPolicy()); deleteAndPurgeCertificate(certName); }); } @@ -337,9 +337,9 @@ public void updateCertificatePolicy() { client.beginCreateCertificate(certName, setupPolicy()); certPoller.waitForCompletion(); KeyVaultCertificateWithPolicy certificate = certPoller.getFinalResult(); - certificate.getCertificatePolicy().setExportable(false); - CertificatePolicy policy = client.updateCertificatePolicy(certName, certificate.getCertificatePolicy()); - validatePolicy(certificate.getCertificatePolicy(), policy); + certificate.getPolicy().setExportable(false); + CertificatePolicy policy = client.updateCertificatePolicy(certName, certificate.getPolicy()); + validatePolicy(certificate.getPolicy(), policy); deleteAndPurgeCertificate(certName); }); } @@ -383,13 +383,13 @@ public void createIssuer() { @Test public void createIssuerEmptyName() { - assertRestException(() -> client.createIssuer("", ""), + assertRestException(() -> client.createIssuer(new CertificateIssuer("", "")), HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD); } @Test public void createIssuerNullProvider() { - assertRestException(() -> client.createIssuer("", null), + assertRestException(() -> client.createIssuer(new CertificateIssuer("", null)), HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTestBase.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTestBase.java index f7003dbf352e..41931f457b63 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTestBase.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTestBase.java @@ -289,12 +289,6 @@ void createIssuereRunner(Consumer testRunner) { testRunner.accept(certificateIssuer); } - @Test - public abstract void createIssuerEmptyName(); - - @Test - public abstract void createIssuerNullProvider(); - @Test public abstract void createIssuerNull(); @@ -356,7 +350,7 @@ void listCertificateIssuersRunner(Consumer> t CertificateContact setupContact() { - return new CertificateContact("name", "first.last@gmail.com", "2323-31232"); + return new CertificateContact().setName("name").setEmail("first.last@gmail.com").setPhone("2323-31232"); } Boolean validateContact(CertificateContact expected, CertificateContact actual) { @@ -414,7 +408,7 @@ void importCertificateRunner(Consumer testRunner) { CertificateIssuer setupIssuer(String issuerName) { return new CertificateIssuer(issuerName, "Test") - .setAdministratorContacts(Arrays.asList(new AdministratorContact("first", "last", "first.last@hotmail.com", "12345"))) + .setAdministratorContacts(Arrays.asList(new AdministratorContact().setFirstName("first").setLastName("last").setEmail("first.last@hotmail.com").setPhone("12345"))) .setAccountId("issuerAccountId") .setEnabled(true) .setOrganizationId("orgId") @@ -452,8 +446,8 @@ X509Certificate loadCerToX509Certificate(KeyVaultCertificateWithPolicy certifica Boolean validateIssuer(CertificateIssuer expected, CertificateIssuer actual) { return expected.getAccountId().equals(actual.getAccountId()) && expected.isEnabled().equals(actual.isEnabled()) - && (actual.getCreated() != null) - && (actual.getUpdated() != null) + && (actual.getCreatedOn() != null) + && (actual.getUpdatedOn() != null) && (actual.getId() != null) && (actual.getId().length() > 0) && expected.getName().equals(actual.getName()) diff --git a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md index 1307e65fc5c9..7564d04158f8 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md @@ -1,4 +1,7 @@ # Release History + +## 4.1.0-beta.1 (Unreleased) + ## 4.0.1 (2019-12-06) ### Major changes diff --git a/sdk/keyvault/azure-security-keyvault-keys/README.md b/sdk/keyvault/azure-security-keyvault-keys/README.md index c9e8151ffab5..81a1e07d97eb 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/README.md +++ b/sdk/keyvault/azure-security-keyvault-keys/README.md @@ -16,7 +16,7 @@ Maven dependency for Azure Key Client library. Add it to your project's pom file com.azure azure-security-keyvault-keys - 4.0.1 + 4.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -35,7 +35,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-security-keyvault-keys - 4.0.1 + 4.1.0-beta.1 com.azure @@ -51,7 +51,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-core-http-okhttp - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index 97dfcfadb3cc..252e1c63465e 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 @@ -82,7 +82,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java index 8143a33328c3..1d93fd6bcbf6 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java @@ -62,6 +62,7 @@ public class CryptographyAsyncClient { private LocalKeyCryptographyClient localKeyCryptographyClient; private final ClientLogger logger = new ClientLogger(CryptographyAsyncClient.class); private String keyCollection; + private final String keyId; /** * Creates a CryptographyAsyncClient that uses {@code pipeline} to service requests @@ -83,6 +84,7 @@ public class CryptographyAsyncClient { throw new IllegalArgumentException("Json Web Key's key type property is not configured"); } this.key = key; + this.keyId = key.getId(); service = RestProxy.create(CryptographyService.class, pipeline); if (!Strings.isNullOrEmpty(key.getId())) { unpackAndValidateId(key.getId()); @@ -102,6 +104,7 @@ public class CryptographyAsyncClient { */ CryptographyAsyncClient(String keyId, HttpPipeline pipeline, CryptographyServiceVersion version) { unpackAndValidateId(keyId); + this.keyId = keyId; service = RestProxy.create(CryptographyService.class, pipeline); cryptographyServiceClient = new CryptographyServiceClient(keyId, service); this.key = null; @@ -123,6 +126,10 @@ private void initializeCryptoClients() { } } + Mono getKeyId() { + return Mono.defer(() -> Mono.just(keyId)); + } + /** * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires * the {@code keys/get} permission. diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyAsyncClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyAsyncClient.java index a9215929a256..d8f25c4d32f4 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyAsyncClient.java @@ -30,15 +30,13 @@ public final class KeyEncryptionKeyAsyncClient extends CryptographyAsyncClient i } /** - * {@inheritDoc} + * Get the identifier of the key to use for cryptography operations. + * + * @return A {@link Mono} containing the key identifier. */ @Override public Mono getKeyId() { - try { - return Mono.just(key.getId()); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return super.getKeyId(); } /** diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyClient.java index 494bfad93373..0c56841b80e8 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionKeyClient.java @@ -21,7 +21,9 @@ public final class KeyEncryptionKeyClient implements KeyEncryptionKey { } /** - * {@inheritDoc} + * Get the identifier of the key to use for cryptography operations. + * + * @return The key identifier. */ @Override public String getKeyId() { diff --git a/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md index 8fa8775c7139..f50843a98aa1 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 4.0.1 (2019-12-04) +## 4.1.0-beta.1 (Unreleased) + +## 4.0.1 (2019-12-04) ## 4.0.0 (2019-10-31) ### Breaking changes diff --git a/sdk/keyvault/azure-security-keyvault-secrets/README.md b/sdk/keyvault/azure-security-keyvault-secrets/README.md index 2602a6b88a20..7f5fecd32039 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/README.md +++ b/sdk/keyvault/azure-security-keyvault-secrets/README.md @@ -17,7 +17,7 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f com.azure azure-security-keyvault-secrets - 4.0.1 + 4.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -36,7 +36,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-security-keyvault-secrets - 4.0.1 + 4.1.0-beta.1 com.azure @@ -52,7 +52,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-core-http-okhttp - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index 07f32283c7df..e16e3f8fdea9 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -34,7 +34,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 @@ -85,7 +85,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/mediaservices/mgmt-v2018_07_01/pom.xml b/sdk/mediaservices/mgmt-v2018_07_01/pom.xml index cdff8a07c970..231b31643ca1 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/pom.xml +++ b/sdk/mediaservices/mgmt-v2018_07_01/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-media - 1.0.0-beta-4 + 1.0.0-beta-5 jar Microsoft Azure SDK for Media Management This package contains Microsoft Media Management SDK. diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/AudioAnalyzerPreset.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/AudioAnalyzerPreset.java index 43e1a5d29309..aa4a3119e31c 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/AudioAnalyzerPreset.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/AudioAnalyzerPreset.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.mediaservices.v2018_07_01; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -26,27 +27,30 @@ public class AudioAnalyzerPreset extends Preset { /** * The language for the audio payload in the input using the BCP-47 format - * of 'language tag-region' (e.g: 'en-US'). The list of supported - * languages are English ('en-US' and 'en-GB'), Spanish ('es-ES' and - * 'es-MX'), French ('fr-FR'), Italian ('it-IT'), Japanese ('ja-JP'), - * Portuguese ('pt-BR'), Chinese ('zh-CN'), German ('de-DE'), Arabic - * ('ar-EG' and 'ar-SY'), Russian ('ru-RU'), Hindi ('hi-IN'), and Korean - * ('ko-KR'). If you know the language of your content, it is recommended - * that you specify it. If the language isn't specified or set to null, - * automatic language detection will choose the first language detected and - * process with the selected language for the duration of the file. This - * language detection feature currently supports English, Chinese, French, - * German, Italian, Japanese, Spanish, Russian, and Portuguese. It does not - * currently support dynamically switching between languages after the - * first language is detected. The automatic detection works best with - * audio recordings with clearly discernable speech. If automatic detection - * fails to find the language, transcription would fallback to 'en-US'.". + * of 'language tag-region' (e.g: 'en-US'). If you know the language of + * your content, it is recommended that you specify it. If the language + * isn't specified or set to null, automatic language detection will choose + * the first language detected and process with the selected language for + * the duration of the file. It does not currently support dynamically + * switching between languages after the first language is detected. The + * automatic detection works best with audio recordings with clearly + * discernable speech. If automatic detection fails to find the language, + * transcription would fallback to 'en-US'." The list of supported + * languages is available here: + * https://go.microsoft.com/fwlink/?linkid=2109463. */ @JsonProperty(value = "audioLanguage") private String audioLanguage; /** - * Get the language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are English ('en-US' and 'en-GB'), Spanish ('es-ES' and 'es-MX'), French ('fr-FR'), Italian ('it-IT'), Japanese ('ja-JP'), Portuguese ('pt-BR'), Chinese ('zh-CN'), German ('de-DE'), Arabic ('ar-EG' and 'ar-SY'), Russian ('ru-RU'), Hindi ('hi-IN'), and Korean ('ko-KR'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. This language detection feature currently supports English, Chinese, French, German, Italian, Japanese, Spanish, Russian, and Portuguese. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'.". + * Dictionary containing key value pairs for parameters not exposed in the + * preset itself. + */ + @JsonProperty(value = "experimentalOptions") + private Map experimentalOptions; + + /** + * Get the language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." The list of supported languages is available here: https://go.microsoft.com/fwlink/?linkid=2109463. * * @return the audioLanguage value */ @@ -55,7 +59,7 @@ public String audioLanguage() { } /** - * Set the language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are English ('en-US' and 'en-GB'), Spanish ('es-ES' and 'es-MX'), French ('fr-FR'), Italian ('it-IT'), Japanese ('ja-JP'), Portuguese ('pt-BR'), Chinese ('zh-CN'), German ('de-DE'), Arabic ('ar-EG' and 'ar-SY'), Russian ('ru-RU'), Hindi ('hi-IN'), and Korean ('ko-KR'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. This language detection feature currently supports English, Chinese, French, German, Italian, Japanese, Spanish, Russian, and Portuguese. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'.". + * Set the language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." The list of supported languages is available here: https://go.microsoft.com/fwlink/?linkid=2109463. * * @param audioLanguage the audioLanguage value to set * @return the AudioAnalyzerPreset object itself. @@ -65,4 +69,24 @@ public AudioAnalyzerPreset withAudioLanguage(String audioLanguage) { return this; } + /** + * Get dictionary containing key value pairs for parameters not exposed in the preset itself. + * + * @return the experimentalOptions value + */ + public Map experimentalOptions() { + return this.experimentalOptions; + } + + /** + * Set dictionary containing key value pairs for parameters not exposed in the preset itself. + * + * @param experimentalOptions the experimentalOptions value to set + * @return the AudioAnalyzerPreset object itself. + */ + public AudioAnalyzerPreset withExperimentalOptions(Map experimentalOptions) { + this.experimentalOptions = experimentalOptions; + return this; + } + } diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/BuiltInStandardEncoderPreset.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/BuiltInStandardEncoderPreset.java index 7c24e1ac6037..902fe6e5dfa4 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/BuiltInStandardEncoderPreset.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/BuiltInStandardEncoderPreset.java @@ -23,14 +23,15 @@ public class BuiltInStandardEncoderPreset extends Preset { * The built-in preset to be used for encoding videos. Possible values * include: 'H264SingleBitrateSD', 'H264SingleBitrate720p', * 'H264SingleBitrate1080p', 'AdaptiveStreaming', 'AACGoodQualityAudio', - * 'ContentAwareEncodingExperimental', 'H264MultipleBitrate1080p', - * 'H264MultipleBitrate720p', 'H264MultipleBitrateSD'. + * 'ContentAwareEncodingExperimental', 'ContentAwareEncoding', + * 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', + * 'H264MultipleBitrateSD'. */ @JsonProperty(value = "presetName", required = true) private EncoderNamedPreset presetName; /** - * Get the built-in preset to be used for encoding videos. Possible values include: 'H264SingleBitrateSD', 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', 'H264MultipleBitrateSD'. + * Get the built-in preset to be used for encoding videos. Possible values include: 'H264SingleBitrateSD', 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', 'ContentAwareEncoding', 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', 'H264MultipleBitrateSD'. * * @return the presetName value */ @@ -39,7 +40,7 @@ public EncoderNamedPreset presetName() { } /** - * Set the built-in preset to be used for encoding videos. Possible values include: 'H264SingleBitrateSD', 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', 'H264MultipleBitrateSD'. + * Set the built-in preset to be used for encoding videos. Possible values include: 'H264SingleBitrateSD', 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', 'ContentAwareEncoding', 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', 'H264MultipleBitrateSD'. * * @param presetName the presetName value to set * @return the BuiltInStandardEncoderPreset object itself. diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayConfiguration.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayConfiguration.java index 83560905ff19..dd1e6da316ed 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayConfiguration.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayConfiguration.java @@ -39,7 +39,7 @@ public class ContentKeyPolicyFairPlayConfiguration extends ContentKeyPolicyConfi /** * The rental and lease key type. Possible values include: 'Unknown', - * 'Undefined', 'PersistentUnlimited', 'PersistentLimited'. + * 'Undefined', 'DualExpiry', 'PersistentUnlimited', 'PersistentLimited'. */ @JsonProperty(value = "rentalAndLeaseKeyType", required = true) private ContentKeyPolicyFairPlayRentalAndLeaseKeyType rentalAndLeaseKeyType; @@ -50,6 +50,12 @@ public class ContentKeyPolicyFairPlayConfiguration extends ContentKeyPolicyConfi @JsonProperty(value = "rentalDuration", required = true) private long rentalDuration; + /** + * Offline rental policy. + */ + @JsonProperty(value = "offlineRentalConfiguration") + private ContentKeyPolicyFairPlayOfflineRentalConfiguration offlineRentalConfiguration; + /** * Get the key that must be used as FairPlay Application Secret key. * @@ -111,7 +117,7 @@ public ContentKeyPolicyFairPlayConfiguration withFairPlayPfx(String fairPlayPfx) } /** - * Get the rental and lease key type. Possible values include: 'Unknown', 'Undefined', 'PersistentUnlimited', 'PersistentLimited'. + * Get the rental and lease key type. Possible values include: 'Unknown', 'Undefined', 'DualExpiry', 'PersistentUnlimited', 'PersistentLimited'. * * @return the rentalAndLeaseKeyType value */ @@ -120,7 +126,7 @@ public ContentKeyPolicyFairPlayRentalAndLeaseKeyType rentalAndLeaseKeyType() { } /** - * Set the rental and lease key type. Possible values include: 'Unknown', 'Undefined', 'PersistentUnlimited', 'PersistentLimited'. + * Set the rental and lease key type. Possible values include: 'Unknown', 'Undefined', 'DualExpiry', 'PersistentUnlimited', 'PersistentLimited'. * * @param rentalAndLeaseKeyType the rentalAndLeaseKeyType value to set * @return the ContentKeyPolicyFairPlayConfiguration object itself. @@ -150,4 +156,24 @@ public ContentKeyPolicyFairPlayConfiguration withRentalDuration(long rentalDurat return this; } + /** + * Get offline rental policy. + * + * @return the offlineRentalConfiguration value + */ + public ContentKeyPolicyFairPlayOfflineRentalConfiguration offlineRentalConfiguration() { + return this.offlineRentalConfiguration; + } + + /** + * Set offline rental policy. + * + * @param offlineRentalConfiguration the offlineRentalConfiguration value to set + * @return the ContentKeyPolicyFairPlayConfiguration object itself. + */ + public ContentKeyPolicyFairPlayConfiguration withOfflineRentalConfiguration(ContentKeyPolicyFairPlayOfflineRentalConfiguration offlineRentalConfiguration) { + this.offlineRentalConfiguration = offlineRentalConfiguration; + return this; + } + } diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayOfflineRentalConfiguration.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayOfflineRentalConfiguration.java new file mode 100644 index 000000000000..afae16b851f7 --- /dev/null +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayOfflineRentalConfiguration.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mediaservices.v2018_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ContentKeyPolicyFairPlayOfflineRentalConfiguration model. + */ +public class ContentKeyPolicyFairPlayOfflineRentalConfiguration { + /** + * Playback duration. + */ + @JsonProperty(value = "playbackDurationSeconds", required = true) + private long playbackDurationSeconds; + + /** + * Storage duration. + */ + @JsonProperty(value = "storageDurationSeconds", required = true) + private long storageDurationSeconds; + + /** + * Get playback duration. + * + * @return the playbackDurationSeconds value + */ + public long playbackDurationSeconds() { + return this.playbackDurationSeconds; + } + + /** + * Set playback duration. + * + * @param playbackDurationSeconds the playbackDurationSeconds value to set + * @return the ContentKeyPolicyFairPlayOfflineRentalConfiguration object itself. + */ + public ContentKeyPolicyFairPlayOfflineRentalConfiguration withPlaybackDurationSeconds(long playbackDurationSeconds) { + this.playbackDurationSeconds = playbackDurationSeconds; + return this; + } + + /** + * Get storage duration. + * + * @return the storageDurationSeconds value + */ + public long storageDurationSeconds() { + return this.storageDurationSeconds; + } + + /** + * Set storage duration. + * + * @param storageDurationSeconds the storageDurationSeconds value to set + * @return the ContentKeyPolicyFairPlayOfflineRentalConfiguration object itself. + */ + public ContentKeyPolicyFairPlayOfflineRentalConfiguration withStorageDurationSeconds(long storageDurationSeconds) { + this.storageDurationSeconds = storageDurationSeconds; + return this; + } + +} diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayRentalAndLeaseKeyType.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayRentalAndLeaseKeyType.java index ec3bebb697ed..5ac9e46af98e 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayRentalAndLeaseKeyType.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ContentKeyPolicyFairPlayRentalAndLeaseKeyType.java @@ -22,6 +22,9 @@ public final class ContentKeyPolicyFairPlayRentalAndLeaseKeyType extends Expanda /** Static value Undefined for ContentKeyPolicyFairPlayRentalAndLeaseKeyType. */ public static final ContentKeyPolicyFairPlayRentalAndLeaseKeyType UNDEFINED = fromString("Undefined"); + /** Static value DualExpiry for ContentKeyPolicyFairPlayRentalAndLeaseKeyType. */ + public static final ContentKeyPolicyFairPlayRentalAndLeaseKeyType DUAL_EXPIRY = fromString("DualExpiry"); + /** Static value PersistentUnlimited for ContentKeyPolicyFairPlayRentalAndLeaseKeyType. */ public static final ContentKeyPolicyFairPlayRentalAndLeaseKeyType PERSISTENT_UNLIMITED = fromString("PersistentUnlimited"); diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/EncoderNamedPreset.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/EncoderNamedPreset.java index 82d64dfcac5b..a385946bf019 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/EncoderNamedPreset.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/EncoderNamedPreset.java @@ -34,6 +34,9 @@ public final class EncoderNamedPreset extends ExpandableStringEnum experimentalOptions; + /** * Get specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," which will keep the input video at its original resolution when analyzed. Using "StandardDefinition" will resize input videos to standard definition while preserving the appropriate aspect ratio. It will only resize if the video is of higher resolution. For example, a 1920x1080 input would be scaled to 640x360 before processing. Switching to "StandardDefinition" will reduce the time it takes to process high resolution video. It may also reduce the cost of using this component (see https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). However, faces that end up being too small in the resized video may not be detected. Possible values include: 'SourceResolution', 'StandardDefinition'. * @@ -57,4 +65,24 @@ public FaceDetectorPreset withResolution(AnalysisResolution resolution) { return this; } + /** + * Get dictionary containing key value pairs for parameters not exposed in the preset itself. + * + * @return the experimentalOptions value + */ + public Map experimentalOptions() { + return this.experimentalOptions; + } + + /** + * Set dictionary containing key value pairs for parameters not exposed in the preset itself. + * + * @param experimentalOptions the experimentalOptions value to set + * @return the FaceDetectorPreset object itself. + */ + public FaceDetectorPreset withExperimentalOptions(Map experimentalOptions) { + this.experimentalOptions = experimentalOptions; + return this; + } + } diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/Job.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/Job.java index 6456556e1199..01305806c565 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/Job.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/Job.java @@ -40,6 +40,11 @@ public interface Job extends HasInner, Indexable, Refreshable, Up */ String description(); + /** + * @return the endTime value. + */ + DateTime endTime(); + /** * @return the id value. */ @@ -70,6 +75,11 @@ public interface Job extends HasInner, Indexable, Refreshable, Up */ Priority priority(); + /** + * @return the startTime value. + */ + DateTime startTime(); + /** * @return the state value. */ diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/JobOutput.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/JobOutput.java index 967937f1ea4f..294843e7ef34 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/JobOutput.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/JobOutput.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.mediaservices.v2018_07_01; +import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -64,6 +65,18 @@ public class JobOutput { @JsonProperty(value = "label") private String label; + /** + * The UTC date and time at which this Job Output began processing. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The UTC date and time at which this Job Output finished processing. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + /** * Get if the JobOutput is in the Error state, it contains the details of the error. * @@ -111,4 +124,22 @@ public JobOutput withLabel(String label) { return this; } + /** + * Get the UTC date and time at which this Job Output began processing. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the UTC date and time at which this Job Output finished processing. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + } diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobImpl.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobImpl.java index 631fdc47292e..77b9373e01e2 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobImpl.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobImpl.java @@ -93,6 +93,11 @@ public String description() { return this.inner().description(); } + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + @Override public String id() { return this.inner().id(); @@ -123,6 +128,11 @@ public Priority priority() { return this.inner().priority(); } + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + @Override public JobState state() { return this.inner().state(); diff --git a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobInner.java b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobInner.java index 373b75be55b3..03615f003cb5 100644 --- a/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobInner.java +++ b/sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobInner.java @@ -79,6 +79,18 @@ public class JobInner extends ProxyResource { @JsonProperty(value = "properties.correlationData") private Map correlationData; + /** + * The UTC date and time at which this Job began processing. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The UTC date and time at which this Job finished processing. + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + /** * Get the UTC date and time when the Job was created, in 'YYYY-MM-DDThh:mm:ssZ' format. * @@ -206,4 +218,22 @@ public JobInner withCorrelationData(Map correlationData) { return this; } + /** + * Get the UTC date and time at which this Job began processing. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the UTC date and time at which this Job finished processing. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + } diff --git a/sdk/netapp/mgmt-v2019_10_01/pom.xml b/sdk/netapp/mgmt-v2019_10_01/pom.xml new file mode 100644 index 000000000000..bbdb5659c8a1 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.netapp.v2019_10_01 + + com.microsoft.azure + azure-arm-parent + 1.2.0 + ../../../pom.management.xml + + azure-mgmt-netapp + 1.0.0-beta + jar + Microsoft Azure SDK for NetApp Management + This package contains Microsoft NetApp Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Accounts.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Accounts.java new file mode 100644 index 000000000000..9d0f4df2b7ca --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Accounts.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.AccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Accounts. + */ +public interface Accounts extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, HasInner { +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ActiveDirectory.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ActiveDirectory.java new file mode 100644 index 000000000000..b686959d021b --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ActiveDirectory.java @@ -0,0 +1,227 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Active Directory. + */ +public class ActiveDirectory { + /** + * Id of the Active Directory. + */ + @JsonProperty(value = "activeDirectoryId") + private String activeDirectoryId; + + /** + * Username of Active Directory domain administrator. + */ + @JsonProperty(value = "username") + private String username; + + /** + * Plain text password of Active Directory domain administrator. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Name of the Active Directory domain. + */ + @JsonProperty(value = "domain") + private String domain; + + /** + * Comma separated list of DNS server IP addresses (IPv4 only) for the + * Active Directory domain. + */ + @JsonProperty(value = "dns") + private String dns; + + /** + * Status of the Active Directory. + */ + @JsonProperty(value = "status") + private String status; + + /** + * NetBIOS name of the SMB server. This name will be registered as a + * computer account in the AD and used to mount volumes. + */ + @JsonProperty(value = "smbServerName") + private String smbServerName; + + /** + * The Organizational Unit (OU) within the Windows Active Directory. + */ + @JsonProperty(value = "organizationalUnit") + private String organizationalUnit; + + /** + * Get id of the Active Directory. + * + * @return the activeDirectoryId value + */ + public String activeDirectoryId() { + return this.activeDirectoryId; + } + + /** + * Set id of the Active Directory. + * + * @param activeDirectoryId the activeDirectoryId value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withActiveDirectoryId(String activeDirectoryId) { + this.activeDirectoryId = activeDirectoryId; + return this; + } + + /** + * Get username of Active Directory domain administrator. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set username of Active Directory domain administrator. + * + * @param username the username value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get plain text password of Active Directory domain administrator. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set plain text password of Active Directory domain administrator. + * + * @param password the password value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get name of the Active Directory domain. + * + * @return the domain value + */ + public String domain() { + return this.domain; + } + + /** + * Set name of the Active Directory domain. + * + * @param domain the domain value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * Get comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain. + * + * @return the dns value + */ + public String dns() { + return this.dns; + } + + /** + * Set comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain. + * + * @param dns the dns value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withDns(String dns) { + this.dns = dns; + return this; + } + + /** + * Get status of the Active Directory. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status of the Active Directory. + * + * @param status the status value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get netBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + * + * @return the smbServerName value + */ + public String smbServerName() { + return this.smbServerName; + } + + /** + * Set netBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + * + * @param smbServerName the smbServerName value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withSmbServerName(String smbServerName) { + this.smbServerName = smbServerName; + return this; + } + + /** + * Get the Organizational Unit (OU) within the Windows Active Directory. + * + * @return the organizationalUnit value + */ + public String organizationalUnit() { + return this.organizationalUnit; + } + + /** + * Set the Organizational Unit (OU) within the Windows Active Directory. + * + * @param organizationalUnit the organizationalUnit value to set + * @return the ActiveDirectory object itself. + */ + public ActiveDirectory withOrganizationalUnit(String organizationalUnit) { + this.organizationalUnit = organizationalUnit; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/AuthorizeRequest.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/AuthorizeRequest.java new file mode 100644 index 000000000000..affc25630a40 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/AuthorizeRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Authorize request. + */ +public class AuthorizeRequest { + /** + * Resource id. + */ + @JsonProperty(value = "remoteVolumeResourceId") + private String remoteVolumeResourceId; + + /** + * Get resource id. + * + * @return the remoteVolumeResourceId value + */ + public String remoteVolumeResourceId() { + return this.remoteVolumeResourceId; + } + + /** + * Set resource id. + * + * @param remoteVolumeResourceId the remoteVolumeResourceId value to set + * @return the AuthorizeRequest object itself. + */ + public AuthorizeRequest withRemoteVolumeResourceId(String remoteVolumeResourceId) { + this.remoteVolumeResourceId = remoteVolumeResourceId; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPool.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPool.java new file mode 100644 index 000000000000..472d3fc0a6d7 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPool.java @@ -0,0 +1,203 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.CapacityPoolInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import java.util.Map; + +/** + * Type representing CapacityPool. + */ +public interface CapacityPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the poolId value. + */ + String poolId(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the serviceLevel value. + */ + ServiceLevel serviceLevel(); + + /** + * @return the size value. + */ + long size(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the CapacityPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNetAppAccount, DefinitionStages.WithLocation, DefinitionStages.WithServiceLevel, DefinitionStages.WithSize, DefinitionStages.WithCreate { + } + + /** + * Grouping of CapacityPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CapacityPool definition. + */ + interface Blank extends WithNetAppAccount { + } + + /** + * The stage of the capacitypool definition allowing to specify NetAppAccount. + */ + interface WithNetAppAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName The name of the resource group + * @param accountName The name of the NetApp account + * @return the next definition stage + */ + WithLocation withExistingNetAppAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the capacitypool definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithServiceLevel withLocation(String location); + } + + /** + * The stage of the capacitypool definition allowing to specify ServiceLevel. + */ + interface WithServiceLevel { + /** + * Specifies serviceLevel. + * @param serviceLevel The service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra' + * @return the next definition stage + */ + WithSize withServiceLevel(ServiceLevel serviceLevel); + } + + /** + * The stage of the capacitypool definition allowing to specify Size. + */ + interface WithSize { + /** + * Specifies size. + * @param size Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104) + * @return the next definition stage + */ + WithCreate withSize(long size); + } + + /** + * The stage of the capacitypool definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a CapacityPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithServiceLevel, UpdateStages.WithSize, UpdateStages.WithTags { + } + + /** + * Grouping of CapacityPool update stages. + */ + interface UpdateStages { + /** + * The stage of the capacitypool update allowing to specify ServiceLevel. + */ + interface WithServiceLevel { + /** + * Specifies serviceLevel. + * @param serviceLevel The service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra' + * @return the next update stage + */ + Update withServiceLevel(ServiceLevel serviceLevel); + } + + /** + * The stage of the capacitypool update allowing to specify Size. + */ + interface WithSize { + /** + * Specifies size. + * @param size Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104) + * @return the next update stage + */ + Update withSize(Long size); + } + + /** + * The stage of the capacitypool update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPoolPatch.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPoolPatch.java new file mode 100644 index 000000000000..36a61278cd2d --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CapacityPoolPatch.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Capacity pool patch resource. + */ +@JsonFlatten +public class CapacityPoolPatch extends Resource { + /** + * size. + * Provisioned size of the pool (in bytes). Allowed values are in 4TiB + * chunks (value must be multiply of 4398046511104). + */ + @JsonProperty(value = "properties.size") + private Long size; + + /** + * serviceLevel. + * The service level of the file system. Possible values include: + * 'Standard', 'Premium', 'Ultra'. + */ + @JsonProperty(value = "properties.serviceLevel") + private ServiceLevel serviceLevel; + + /** + * Get provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + * + * @return the size value + */ + public Long size() { + return this.size; + } + + /** + * Set provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + * + * @param size the size value to set + * @return the CapacityPoolPatch object itself. + */ + public CapacityPoolPatch withSize(Long size) { + this.size = size; + return this; + } + + /** + * Get the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @return the serviceLevel value + */ + public ServiceLevel serviceLevel() { + return this.serviceLevel; + } + + /** + * Set the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @param serviceLevel the serviceLevel value to set + * @return the CapacityPoolPatch object itself. + */ + public CapacityPoolPatch withServiceLevel(ServiceLevel serviceLevel) { + this.serviceLevel = serviceLevel; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CheckNameResourceTypes.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CheckNameResourceTypes.java new file mode 100644 index 000000000000..bd9d9ad7b226 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/CheckNameResourceTypes.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CheckNameResourceTypes. + */ +public final class CheckNameResourceTypes extends ExpandableStringEnum { + /** Static value Microsoft.NetApp/netAppAccounts for CheckNameResourceTypes. */ + public static final CheckNameResourceTypes MICROSOFT_NET_APPNET_APP_ACCOUNTS = fromString("Microsoft.NetApp/netAppAccounts"); + + /** Static value Microsoft.NetApp/netAppAccounts/capacityPools for CheckNameResourceTypes. */ + public static final CheckNameResourceTypes MICROSOFT_NET_APPNET_APP_ACCOUNTSCAPACITY_POOLS = fromString("Microsoft.NetApp/netAppAccounts/capacityPools"); + + /** Static value Microsoft.NetApp/netAppAccounts/capacityPools/volumes for CheckNameResourceTypes. */ + public static final CheckNameResourceTypes MICROSOFT_NET_APPNET_APP_ACCOUNTSCAPACITY_POOLSVOLUMES = fromString("Microsoft.NetApp/netAppAccounts/capacityPools/volumes"); + + /** Static value Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots for CheckNameResourceTypes. */ + public static final CheckNameResourceTypes MICROSOFT_NET_APPNET_APP_ACCOUNTSCAPACITY_POOLSVOLUMESSNAPSHOTS = fromString("Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"); + + /** + * Creates or finds a CheckNameResourceTypes from its string representation. + * @param name a name to look for + * @return the corresponding CheckNameResourceTypes + */ + @JsonCreator + public static CheckNameResourceTypes fromString(String name) { + return fromString(name, CheckNameResourceTypes.class); + } + + /** + * @return known CheckNameResourceTypes values + */ + public static Collection values() { + return values(CheckNameResourceTypes.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Dimension.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Dimension.java new file mode 100644 index 000000000000..2734033114fb --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Dimension.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Dimension of blobs, possibly be blob type or access tier. + */ +public class Dimension { + /** + * Display name of dimension. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display name of dimension. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get display name of dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set display name of dimension. + * + * @param name the name value to set + * @return the Dimension object itself. + */ + public Dimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get display name of dimension. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set display name of dimension. + * + * @param displayName the displayName value to set + * @return the Dimension object itself. + */ + public Dimension withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/EndpointType.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/EndpointType.java new file mode 100644 index 000000000000..b52f57b9a9ef --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/EndpointType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for EndpointType. + */ +public final class EndpointType extends ExpandableStringEnum { + /** Static value src for EndpointType. */ + public static final EndpointType SRC = fromString("src"); + + /** Static value dst for EndpointType. */ + public static final EndpointType DST = fromString("dst"); + + /** + * Creates or finds a EndpointType from its string representation. + * @param name a name to look for + * @return the corresponding EndpointType + */ + @JsonCreator + public static EndpointType fromString(String name) { + return fromString(name, EndpointType.class); + } + + /** + * @return known EndpointType values + */ + public static Collection values() { + return values(EndpointType.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ExportPolicyRule.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ExportPolicyRule.java new file mode 100644 index 000000000000..c0b05158e3a4 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ExportPolicyRule.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Volume Export Policy Rule. + */ +public class ExportPolicyRule { + /** + * Order index. + */ + @JsonProperty(value = "ruleIndex") + private Integer ruleIndex; + + /** + * Read only access. + */ + @JsonProperty(value = "unixReadOnly") + private Boolean unixReadOnly; + + /** + * Read and write access. + */ + @JsonProperty(value = "unixReadWrite") + private Boolean unixReadWrite; + + /** + * Allows CIFS protocol. + */ + @JsonProperty(value = "cifs") + private Boolean cifs; + + /** + * Allows NFSv3 protocol. + */ + @JsonProperty(value = "nfsv3") + private Boolean nfsv3; + + /** + * Allows NFSv4.1 protocol. + */ + @JsonProperty(value = "nfsv41") + private Boolean nfsv41; + + /** + * Client ingress specification as comma separated string with IPv4 CIDRs, + * IPv4 host addresses and host names. + */ + @JsonProperty(value = "allowedClients") + private String allowedClients; + + /** + * Get order index. + * + * @return the ruleIndex value + */ + public Integer ruleIndex() { + return this.ruleIndex; + } + + /** + * Set order index. + * + * @param ruleIndex the ruleIndex value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withRuleIndex(Integer ruleIndex) { + this.ruleIndex = ruleIndex; + return this; + } + + /** + * Get read only access. + * + * @return the unixReadOnly value + */ + public Boolean unixReadOnly() { + return this.unixReadOnly; + } + + /** + * Set read only access. + * + * @param unixReadOnly the unixReadOnly value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withUnixReadOnly(Boolean unixReadOnly) { + this.unixReadOnly = unixReadOnly; + return this; + } + + /** + * Get read and write access. + * + * @return the unixReadWrite value + */ + public Boolean unixReadWrite() { + return this.unixReadWrite; + } + + /** + * Set read and write access. + * + * @param unixReadWrite the unixReadWrite value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withUnixReadWrite(Boolean unixReadWrite) { + this.unixReadWrite = unixReadWrite; + return this; + } + + /** + * Get allows CIFS protocol. + * + * @return the cifs value + */ + public Boolean cifs() { + return this.cifs; + } + + /** + * Set allows CIFS protocol. + * + * @param cifs the cifs value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withCifs(Boolean cifs) { + this.cifs = cifs; + return this; + } + + /** + * Get allows NFSv3 protocol. + * + * @return the nfsv3 value + */ + public Boolean nfsv3() { + return this.nfsv3; + } + + /** + * Set allows NFSv3 protocol. + * + * @param nfsv3 the nfsv3 value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withNfsv3(Boolean nfsv3) { + this.nfsv3 = nfsv3; + return this; + } + + /** + * Get allows NFSv4.1 protocol. + * + * @return the nfsv41 value + */ + public Boolean nfsv41() { + return this.nfsv41; + } + + /** + * Set allows NFSv4.1 protocol. + * + * @param nfsv41 the nfsv41 value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withNfsv41(Boolean nfsv41) { + this.nfsv41 = nfsv41; + return this; + } + + /** + * Get client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. + * + * @return the allowedClients value + */ + public String allowedClients() { + return this.allowedClients; + } + + /** + * Set client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. + * + * @param allowedClients the allowedClients value to set + * @return the ExportPolicyRule object itself. + */ + public ExportPolicyRule withAllowedClients(String allowedClients) { + this.allowedClients = allowedClients; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/InAvailabilityReasonType.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/InAvailabilityReasonType.java new file mode 100644 index 000000000000..895f0232907f --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/InAvailabilityReasonType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InAvailabilityReasonType. + */ +public final class InAvailabilityReasonType extends ExpandableStringEnum { + /** Static value Invalid for InAvailabilityReasonType. */ + public static final InAvailabilityReasonType INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for InAvailabilityReasonType. */ + public static final InAvailabilityReasonType ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a InAvailabilityReasonType from its string representation. + * @param name a name to look for + * @return the corresponding InAvailabilityReasonType + */ + @JsonCreator + public static InAvailabilityReasonType fromString(String name) { + return fromString(name, InAvailabilityReasonType.class); + } + + /** + * @return known InAvailabilityReasonType values + */ + public static Collection values() { + return values(InAvailabilityReasonType.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MetricSpecification.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MetricSpecification.java new file mode 100644 index 000000000000..4109b2dc3cc8 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MetricSpecification.java @@ -0,0 +1,252 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric specification of operation. + */ +public class MetricSpecification { + /** + * Name of metric specification. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display name of metric specification. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Display description of metric specification. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /** + * Unit could be Bytes or Count. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * Dimensions of blobs, including blob type and access tier. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Aggregation type could be Average. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /** + * The property to decide fill gap with zero or not. + */ + @JsonProperty(value = "fillGapWithZero") + private Boolean fillGapWithZero; + + /** + * The category this metric specification belong to, could be Capacity. + */ + @JsonProperty(value = "category") + private String category; + + /** + * Account Resource Id. + */ + @JsonProperty(value = "resourceIdDimensionNameOverride") + private String resourceIdDimensionNameOverride; + + /** + * Get name of metric specification. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of metric specification. + * + * @param name the name value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get display name of metric specification. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set display name of metric specification. + * + * @param displayName the displayName value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get display description of metric specification. + * + * @return the displayDescription value + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set display description of metric specification. + * + * @param displayDescription the displayDescription value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get unit could be Bytes or Count. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set unit could be Bytes or Count. + * + * @param unit the unit value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get dimensions of blobs, including blob type and access tier. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set dimensions of blobs, including blob type and access tier. + * + * @param dimensions the dimensions value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get aggregation type could be Average. + * + * @return the aggregationType value + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set aggregation type could be Average. + * + * @param aggregationType the aggregationType value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the property to decide fill gap with zero or not. + * + * @return the fillGapWithZero value + */ + public Boolean fillGapWithZero() { + return this.fillGapWithZero; + } + + /** + * Set the property to decide fill gap with zero or not. + * + * @param fillGapWithZero the fillGapWithZero value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withFillGapWithZero(Boolean fillGapWithZero) { + this.fillGapWithZero = fillGapWithZero; + return this; + } + + /** + * Get the category this metric specification belong to, could be Capacity. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set the category this metric specification belong to, could be Capacity. + * + * @param category the category value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get account Resource Id. + * + * @return the resourceIdDimensionNameOverride value + */ + public String resourceIdDimensionNameOverride() { + return this.resourceIdDimensionNameOverride; + } + + /** + * Set account Resource Id. + * + * @param resourceIdDimensionNameOverride the resourceIdDimensionNameOverride value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withResourceIdDimensionNameOverride(String resourceIdDimensionNameOverride) { + this.resourceIdDimensionNameOverride = resourceIdDimensionNameOverride; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MirrorState.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MirrorState.java new file mode 100644 index 000000000000..c63bbb36a140 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MirrorState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MirrorState. + */ +public final class MirrorState extends ExpandableStringEnum { + /** Static value Uninitialized for MirrorState. */ + public static final MirrorState UNINITIALIZED = fromString("Uninitialized"); + + /** Static value Mirrored for MirrorState. */ + public static final MirrorState MIRRORED = fromString("Mirrored"); + + /** Static value Broken for MirrorState. */ + public static final MirrorState BROKEN = fromString("Broken"); + + /** + * Creates or finds a MirrorState from its string representation. + * @param name a name to look for + * @return the corresponding MirrorState + */ + @JsonCreator + public static MirrorState fromString(String name) { + return fromString(name, MirrorState.class); + } + + /** + * @return known MirrorState values + */ + public static Collection values() { + return values(MirrorState.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTarget.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTarget.java new file mode 100644 index 000000000000..34cb0d820ad5 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTarget.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.MountTargetInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import java.util.Map; + +/** + * Type representing MountTarget. + */ +public interface MountTarget extends HasInner, HasManager { + /** + * @return the endIp value. + */ + String endIp(); + + /** + * @return the fileSystemId value. + */ + String fileSystemId(); + + /** + * @return the gateway value. + */ + String gateway(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the ipAddress value. + */ + String ipAddress(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the mountTargetId value. + */ + String mountTargetId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the netmask value. + */ + String netmask(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the smbServerFqdn value. + */ + String smbServerFqdn(); + + /** + * @return the startIp value. + */ + String startIp(); + + /** + * @return the subnet value. + */ + String subnet(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTargets.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTargets.java new file mode 100644 index 000000000000..9e8cbafb1041 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/MountTargets.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.MountTargetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MountTargets. + */ +public interface MountTargets extends HasInner { + /** + * Describe all mount targets. + * List all mount targets associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccount.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccount.java new file mode 100644 index 000000000000..143913a9d91f --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccount.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppAccountInner; + +/** + * Type representing NetAppAccount. + */ +public interface NetAppAccount extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the activeDirectories value. + */ + List activeDirectories(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * The entirety of the NetAppAccount definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of NetAppAccount definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NetAppAccount definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the NetAppAccount definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the netappaccount definition allowing to specify ActiveDirectories. + */ + interface WithActiveDirectories { + /** + * Specifies activeDirectories. + * @param activeDirectories Active Directories + * @return the next definition stage + */ + WithCreate withActiveDirectories(List activeDirectories); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithActiveDirectories { + } + } + /** + * The template for a NetAppAccount update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithActiveDirectories { + } + + /** + * Grouping of NetAppAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the netappaccount update allowing to specify ActiveDirectories. + */ + interface WithActiveDirectories { + /** + * Specifies activeDirectories. + * @param activeDirectories Active Directories + * @return the next update stage + */ + Update withActiveDirectories(List activeDirectories); + } + + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccountPatch.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccountPatch.java new file mode 100644 index 000000000000..48701b8863a6 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppAccountPatch.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * NetApp account patch resource. + */ +@JsonFlatten +public class NetAppAccountPatch extends Resource { + /** + * Azure lifecycle management. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Active Directories. + */ + @JsonProperty(value = "properties.activeDirectories") + private List activeDirectories; + + /** + * Get azure lifecycle management. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get active Directories. + * + * @return the activeDirectories value + */ + public List activeDirectories() { + return this.activeDirectories; + } + + /** + * Set active Directories. + * + * @param activeDirectories the activeDirectories value to set + * @return the NetAppAccountPatch object itself. + */ + public NetAppAccountPatch withActiveDirectories(List activeDirectories) { + this.activeDirectories = activeDirectories; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppResources.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppResources.java new file mode 100644 index 000000000000..f0e92898f5db --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/NetAppResources.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppResourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing NetAppResources. + */ +public interface NetAppResources extends HasInner { + /** + * Check resource name availability. + * Check if a resource name is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup); + + /** + * Check file path availability. + * Check if a file path is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkFilePathAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operation.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operation.java new file mode 100644 index 000000000000..748fde47e72f --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operation.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the serviceSpecification value. + */ + ServiceSpecification serviceSpecification(); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/OperationDisplay.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/OperationDisplay.java new file mode 100644 index 000000000000..f317a8d023d9 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft NetApp. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft NetApp. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft NetApp. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get type of operation: get, read, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set type of operation: get, read, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation description. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operations.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operations.java new file mode 100644 index 000000000000..f924852959fd --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Operations.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Describes the Resource Provider. + * Lists all of the available Microsoft.NetApp Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Pools.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Pools.java new file mode 100644 index 000000000000..3ca768a00b57 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Pools.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.PoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Pools. + */ +public interface Pools extends SupportsCreating, HasInner { + /** + * Describe a Capacity Pool. + * Get details of the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String poolName); + + /** + * Describe all Capacity Pools. + * List all capacity pools in the NetApp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String accountName); + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String poolName); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/RelationshipStatus.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/RelationshipStatus.java new file mode 100644 index 000000000000..887d23eec9f1 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/RelationshipStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for RelationshipStatus. + */ +public final class RelationshipStatus extends ExpandableStringEnum { + /** Static value Idle for RelationshipStatus. */ + public static final RelationshipStatus IDLE = fromString("Idle"); + + /** Static value Transferring for RelationshipStatus. */ + public static final RelationshipStatus TRANSFERRING = fromString("Transferring"); + + /** + * Creates or finds a RelationshipStatus from its string representation. + * @param name a name to look for + * @return the corresponding RelationshipStatus + */ + @JsonCreator + public static RelationshipStatus fromString(String name) { + return fromString(name, RelationshipStatus.class); + } + + /** + * @return known RelationshipStatus values + */ + public static Collection values() { + return values(RelationshipStatus.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationObject.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationObject.java new file mode 100644 index 000000000000..c605dd9e91b4 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationObject.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Replication properties. + */ +public class ReplicationObject { + /** + * Id. + */ + @JsonProperty(value = "replicationId") + private String replicationId; + + /** + * Indicates whether the local volume is the source or destination for the + * Volume Replication. Possible values include: 'src', 'dst'. + */ + @JsonProperty(value = "endpointType") + private EndpointType endpointType; + + /** + * Schedule. Possible values include: '_10minutely', 'hourly', 'daily', + * 'weekly', 'monthly'. + */ + @JsonProperty(value = "replicationSchedule", required = true) + private ReplicationSchedule replicationSchedule; + + /** + * The resource ID of the remote volume. + */ + @JsonProperty(value = "remoteVolumeResourceId", required = true) + private String remoteVolumeResourceId; + + /** + * The remote region for the other end of the Volume Replication. + */ + @JsonProperty(value = "remoteVolumeRegion") + private String remoteVolumeRegion; + + /** + * Get id. + * + * @return the replicationId value + */ + public String replicationId() { + return this.replicationId; + } + + /** + * Set id. + * + * @param replicationId the replicationId value to set + * @return the ReplicationObject object itself. + */ + public ReplicationObject withReplicationId(String replicationId) { + this.replicationId = replicationId; + return this; + } + + /** + * Get indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: 'src', 'dst'. + * + * @return the endpointType value + */ + public EndpointType endpointType() { + return this.endpointType; + } + + /** + * Set indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: 'src', 'dst'. + * + * @param endpointType the endpointType value to set + * @return the ReplicationObject object itself. + */ + public ReplicationObject withEndpointType(EndpointType endpointType) { + this.endpointType = endpointType; + return this; + } + + /** + * Get schedule. Possible values include: '_10minutely', 'hourly', 'daily', 'weekly', 'monthly'. + * + * @return the replicationSchedule value + */ + public ReplicationSchedule replicationSchedule() { + return this.replicationSchedule; + } + + /** + * Set schedule. Possible values include: '_10minutely', 'hourly', 'daily', 'weekly', 'monthly'. + * + * @param replicationSchedule the replicationSchedule value to set + * @return the ReplicationObject object itself. + */ + public ReplicationObject withReplicationSchedule(ReplicationSchedule replicationSchedule) { + this.replicationSchedule = replicationSchedule; + return this; + } + + /** + * Get the resource ID of the remote volume. + * + * @return the remoteVolumeResourceId value + */ + public String remoteVolumeResourceId() { + return this.remoteVolumeResourceId; + } + + /** + * Set the resource ID of the remote volume. + * + * @param remoteVolumeResourceId the remoteVolumeResourceId value to set + * @return the ReplicationObject object itself. + */ + public ReplicationObject withRemoteVolumeResourceId(String remoteVolumeResourceId) { + this.remoteVolumeResourceId = remoteVolumeResourceId; + return this; + } + + /** + * Get the remote region for the other end of the Volume Replication. + * + * @return the remoteVolumeRegion value + */ + public String remoteVolumeRegion() { + return this.remoteVolumeRegion; + } + + /** + * Set the remote region for the other end of the Volume Replication. + * + * @param remoteVolumeRegion the remoteVolumeRegion value to set + * @return the ReplicationObject object itself. + */ + public ReplicationObject withRemoteVolumeRegion(String remoteVolumeRegion) { + this.remoteVolumeRegion = remoteVolumeRegion; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationSchedule.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationSchedule.java new file mode 100644 index 000000000000..58329e33bfa3 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationSchedule.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReplicationSchedule. + */ +public final class ReplicationSchedule extends ExpandableStringEnum { + /** Static value _10minutely for ReplicationSchedule. */ + public static final ReplicationSchedule _10MINUTELY = fromString("_10minutely"); + + /** Static value hourly for ReplicationSchedule. */ + public static final ReplicationSchedule HOURLY = fromString("hourly"); + + /** Static value daily for ReplicationSchedule. */ + public static final ReplicationSchedule DAILY = fromString("daily"); + + /** Static value weekly for ReplicationSchedule. */ + public static final ReplicationSchedule WEEKLY = fromString("weekly"); + + /** Static value monthly for ReplicationSchedule. */ + public static final ReplicationSchedule MONTHLY = fromString("monthly"); + + /** + * Creates or finds a ReplicationSchedule from its string representation. + * @param name a name to look for + * @return the corresponding ReplicationSchedule + */ + @JsonCreator + public static ReplicationSchedule fromString(String name) { + return fromString(name, ReplicationSchedule.class); + } + + /** + * @return known ReplicationSchedule values + */ + public static Collection values() { + return values(ReplicationSchedule.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationStatus.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationStatus.java new file mode 100644 index 000000000000..f869df5b5541 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ReplicationStatus.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.ReplicationStatusInner; + +/** + * Type representing ReplicationStatus. + */ +public interface ReplicationStatus extends HasInner, HasManager { + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the healthy value. + */ + Boolean healthy(); + + /** + * @return the mirrorState value. + */ + MirrorState mirrorState(); + + /** + * @return the relationshipStatus value. + */ + RelationshipStatus relationshipStatus(); + + /** + * @return the totalProgress value. + */ + String totalProgress(); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailability.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailability.java new file mode 100644 index 000000000000..1fa0289a97e3 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailability.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.ResourceNameAvailabilityInner; + +/** + * Type representing ResourceNameAvailability. + */ +public interface ResourceNameAvailability extends HasInner, HasManager { + /** + * @return the isAvailable value. + */ + Boolean isAvailable(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the reason value. + */ + InAvailabilityReasonType reason(); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailabilityRequest.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailabilityRequest.java new file mode 100644 index 000000000000..48d2638750fe --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ResourceNameAvailabilityRequest.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource name availability request content. + */ +public class ResourceNameAvailabilityRequest { + /** + * Resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Resource type used for verification. Possible values include: + * 'Microsoft.NetApp/netAppAccounts', + * 'Microsoft.NetApp/netAppAccounts/capacityPools', + * 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', + * 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots'. + */ + @JsonProperty(value = "type", required = true) + private CheckNameResourceTypes type; + + /** + * Resource group name. + */ + @JsonProperty(value = "resourceGroup", required = true) + private String resourceGroup; + + /** + * Get resource name to verify. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set resource name to verify. + * + * @param name the name value to set + * @return the ResourceNameAvailabilityRequest object itself. + */ + public ResourceNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots'. + * + * @return the type value + */ + public CheckNameResourceTypes type() { + return this.type; + } + + /** + * Set resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots'. + * + * @param type the type value to set + * @return the ResourceNameAvailabilityRequest object itself. + */ + public ResourceNameAvailabilityRequest withType(CheckNameResourceTypes type) { + this.type = type; + return this; + } + + /** + * Get resource group name. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set resource group name. + * + * @param resourceGroup the resourceGroup value to set + * @return the ResourceNameAvailabilityRequest object itself. + */ + public ResourceNameAvailabilityRequest withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceLevel.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceLevel.java new file mode 100644 index 000000000000..61b09c33ab90 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceLevel.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServiceLevel. + */ +public final class ServiceLevel extends ExpandableStringEnum { + /** Static value Standard for ServiceLevel. */ + public static final ServiceLevel STANDARD = fromString("Standard"); + + /** Static value Premium for ServiceLevel. */ + public static final ServiceLevel PREMIUM = fromString("Premium"); + + /** Static value Ultra for ServiceLevel. */ + public static final ServiceLevel ULTRA = fromString("Ultra"); + + /** + * Creates or finds a ServiceLevel from its string representation. + * @param name a name to look for + * @return the corresponding ServiceLevel + */ + @JsonCreator + public static ServiceLevel fromString(String name) { + return fromString(name, ServiceLevel.class); + } + + /** + * @return known ServiceLevel values + */ + public static Collection values() { + return values(ServiceLevel.class); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceSpecification.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceSpecification.java new file mode 100644 index 000000000000..21c8e4f35f0f --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/ServiceSpecification.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * One property of operation, include metric specifications. + */ +public class ServiceSpecification { + /** + * Metric specifications of operation. + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get metric specifications of operation. + * + * @return the metricSpecifications value + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set metric specifications of operation. + * + * @param metricSpecifications the metricSpecifications value to set + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withMetricSpecifications(List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshot.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshot.java new file mode 100644 index 000000000000..4b17b1359726 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshot.java @@ -0,0 +1,182 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.SnapshotInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Snapshot. + */ +public interface Snapshot extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the created value. + */ + DateTime created(); + + /** + * @return the fileSystemId value. + */ + String fileSystemId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the snapshotId value. + */ + String snapshotId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Snapshot definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithVolume, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Snapshot definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Snapshot definition. + */ + interface Blank extends WithVolume { + } + + /** + * The stage of the snapshot definition allowing to specify Volume. + */ + interface WithVolume { + /** + * Specifies resourceGroupName, accountName, poolName, volumeName. + * @param resourceGroupName The name of the resource group + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @return the next definition stage + */ + WithLocation withExistingVolume(String resourceGroupName, String accountName, String poolName, String volumeName); + } + + /** + * The stage of the snapshot definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the snapshot definition allowing to specify FileSystemId. + */ + interface WithFileSystemId { + /** + * Specifies fileSystemId. + * @param fileSystemId UUID v4 used to identify the FileSystem + * @return the next definition stage + */ + WithCreate withFileSystemId(String fileSystemId); + } + + /** + * The stage of the snapshot definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithFileSystemId, DefinitionStages.WithTags { + } + } + /** + * The template for a Snapshot update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithFileSystemId, UpdateStages.WithTags { + } + + /** + * Grouping of Snapshot update stages. + */ + interface UpdateStages { + /** + * The stage of the snapshot update allowing to specify FileSystemId. + */ + interface WithFileSystemId { + /** + * Specifies fileSystemId. + * @param fileSystemId UUID v4 used to identify the FileSystem + * @return the next update stage + */ + Update withFileSystemId(String fileSystemId); + } + + /** + * The stage of the snapshot update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/SnapshotPatch.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/SnapshotPatch.java new file mode 100644 index 000000000000..de78a3dcb6d3 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/SnapshotPatch.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Snapshot patch. + */ +public class SnapshotPatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the SnapshotPatch object itself. + */ + public SnapshotPatch withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshots.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshots.java new file mode 100644 index 000000000000..c7ed4ce1b721 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Snapshots.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.SnapshotsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Snapshots. + */ +public interface Snapshots extends SupportsCreating, HasInner { + /** + * Describe a snapshot. + * Get details of the specified snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName); + + /** + * Describe all snapshots. + * List all snapshots associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volume.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volume.java new file mode 100644 index 000000000000..0dd2324cab02 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volume.java @@ -0,0 +1,375 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.VolumeInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.NetAppManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing Volume. + */ +public interface Volume extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the baremetalTenantId value. + */ + String baremetalTenantId(); + + /** + * @return the creationToken value. + */ + String creationToken(); + + /** + * @return the dataProtection value. + */ + VolumePropertiesDataProtection dataProtection(); + + /** + * @return the exportPolicy value. + */ + VolumePropertiesExportPolicy exportPolicy(); + + /** + * @return the fileSystemId value. + */ + String fileSystemId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isRestoring value. + */ + Boolean isRestoring(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the mountTargets value. + */ + Object mountTargets(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the protocolTypes value. + */ + List protocolTypes(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the serviceLevel value. + */ + ServiceLevel serviceLevel(); + + /** + * @return the snapshotId value. + */ + String snapshotId(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageThreshold value. + */ + long usageThreshold(); + + /** + * @return the volumeType value. + */ + String volumeType(); + + /** + * The entirety of the Volume definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCapacityPool, DefinitionStages.WithCreationToken, DefinitionStages.WithLocation, DefinitionStages.WithSubnetId, DefinitionStages.WithUsageThreshold, DefinitionStages.WithCreate { + } + + /** + * Grouping of Volume definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Volume definition. + */ + interface Blank extends WithCapacityPool { + } + + /** + * The stage of the volume definition allowing to specify CapacityPool. + */ + interface WithCapacityPool { + /** + * Specifies resourceGroupName, accountName, poolName. + * @param resourceGroupName The name of the resource group + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @return the next definition stage + */ + WithCreationToken withExistingCapacityPool(String resourceGroupName, String accountName, String poolName); + } + + /** + * The stage of the volume definition allowing to specify CreationToken. + */ + interface WithCreationToken { + /** + * Specifies creationToken. + * @param creationToken A unique file path for the volume. Used when creating mount targets + * @return the next definition stage + */ + WithLocation withCreationToken(String creationToken); + } + + /** + * The stage of the volume definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithSubnetId withLocation(String location); + } + + /** + * The stage of the volume definition allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + * @param subnetId The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes + * @return the next definition stage + */ + WithUsageThreshold withSubnetId(String subnetId); + } + + /** + * The stage of the volume definition allowing to specify UsageThreshold. + */ + interface WithUsageThreshold { + /** + * Specifies usageThreshold. + * @param usageThreshold Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes + * @return the next definition stage + */ + WithCreate withUsageThreshold(long usageThreshold); + } + + /** + * The stage of the volume definition allowing to specify DataProtection. + */ + interface WithDataProtection { + /** + * Specifies dataProtection. + * @param dataProtection DataProtection type volumes include an object containing details of the replication + * @return the next definition stage + */ + WithCreate withDataProtection(VolumePropertiesDataProtection dataProtection); + } + + /** + * The stage of the volume definition allowing to specify ExportPolicy. + */ + interface WithExportPolicy { + /** + * Specifies exportPolicy. + * @param exportPolicy Set of export policy rules + * @return the next definition stage + */ + WithCreate withExportPolicy(VolumePropertiesExportPolicy exportPolicy); + } + + /** + * The stage of the volume definition allowing to specify IsRestoring. + */ + interface WithIsRestoring { + /** + * Specifies isRestoring. + * @param isRestoring Restoring + * @return the next definition stage + */ + WithCreate withIsRestoring(Boolean isRestoring); + } + + /** + * The stage of the volume definition allowing to specify MountTargets. + */ + interface WithMountTargets { + /** + * Specifies mountTargets. + * @param mountTargets List of mount targets + * @return the next definition stage + */ + WithCreate withMountTargets(Object mountTargets); + } + + /** + * The stage of the volume definition allowing to specify ProtocolTypes. + */ + interface WithProtocolTypes { + /** + * Specifies protocolTypes. + * @param protocolTypes Set of protocol types + * @return the next definition stage + */ + WithCreate withProtocolTypes(List protocolTypes); + } + + /** + * The stage of the volume definition allowing to specify ServiceLevel. + */ + interface WithServiceLevel { + /** + * Specifies serviceLevel. + * @param serviceLevel The service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra' + * @return the next definition stage + */ + WithCreate withServiceLevel(ServiceLevel serviceLevel); + } + + /** + * The stage of the volume definition allowing to specify SnapshotId. + */ + interface WithSnapshotId { + /** + * Specifies snapshotId. + * @param snapshotId UUID v4 or resource identifier used to identify the Snapshot + * @return the next definition stage + */ + WithCreate withSnapshotId(String snapshotId); + } + + /** + * The stage of the volume definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the volume definition allowing to specify VolumeType. + */ + interface WithVolumeType { + /** + * Specifies volumeType. + * @param volumeType What type of volume is this + * @return the next definition stage + */ + WithCreate withVolumeType(String volumeType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDataProtection, DefinitionStages.WithExportPolicy, DefinitionStages.WithIsRestoring, DefinitionStages.WithMountTargets, DefinitionStages.WithProtocolTypes, DefinitionStages.WithServiceLevel, DefinitionStages.WithSnapshotId, DefinitionStages.WithTags, DefinitionStages.WithVolumeType { + } + } + /** + * The template for a Volume update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithExportPolicy, UpdateStages.WithServiceLevel, UpdateStages.WithTags, UpdateStages.WithUsageThreshold { + } + + /** + * Grouping of Volume update stages. + */ + interface UpdateStages { + /** + * The stage of the volume update allowing to specify ExportPolicy. + */ + interface WithExportPolicy { + /** + * Specifies exportPolicy. + * @param exportPolicy Set of export policy rules + * @return the next update stage + */ + Update withExportPolicy(VolumePatchPropertiesExportPolicy exportPolicy); + } + + /** + * The stage of the volume update allowing to specify ServiceLevel. + */ + interface WithServiceLevel { + /** + * Specifies serviceLevel. + * @param serviceLevel The service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra' + * @return the next update stage + */ + Update withServiceLevel(ServiceLevel serviceLevel); + } + + /** + * The stage of the volume update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the volume update allowing to specify UsageThreshold. + */ + interface WithUsageThreshold { + /** + * Specifies usageThreshold. + * @param usageThreshold Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes + * @return the next update stage + */ + Update withUsageThreshold(Long usageThreshold); + } + + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatch.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatch.java new file mode 100644 index 000000000000..e945e5b7cd67 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatch.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Volume patch resource. + */ +@JsonFlatten +public class VolumePatch extends Resource { + /** + * serviceLevel. + * The service level of the file system. Possible values include: + * 'Standard', 'Premium', 'Ultra'. + */ + @JsonProperty(value = "properties.serviceLevel") + private ServiceLevel serviceLevel; + + /** + * usageThreshold. + * Maximum storage quota allowed for a file system in bytes. This is a soft + * quota used for alerting only. Minimum size is 100 GiB. Upper limit is + * 100TiB. Specified in bytes. + */ + @JsonProperty(value = "properties.usageThreshold") + private Long usageThreshold; + + /** + * exportPolicy. + * Set of export policy rules. + */ + @JsonProperty(value = "properties.exportPolicy") + private VolumePatchPropertiesExportPolicy exportPolicy; + + /** + * Get the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @return the serviceLevel value + */ + public ServiceLevel serviceLevel() { + return this.serviceLevel; + } + + /** + * Set the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @param serviceLevel the serviceLevel value to set + * @return the VolumePatch object itself. + */ + public VolumePatch withServiceLevel(ServiceLevel serviceLevel) { + this.serviceLevel = serviceLevel; + return this; + } + + /** + * Get maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. + * + * @return the usageThreshold value + */ + public Long usageThreshold() { + return this.usageThreshold; + } + + /** + * Set maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. + * + * @param usageThreshold the usageThreshold value to set + * @return the VolumePatch object itself. + */ + public VolumePatch withUsageThreshold(Long usageThreshold) { + this.usageThreshold = usageThreshold; + return this; + } + + /** + * Get set of export policy rules. + * + * @return the exportPolicy value + */ + public VolumePatchPropertiesExportPolicy exportPolicy() { + return this.exportPolicy; + } + + /** + * Set set of export policy rules. + * + * @param exportPolicy the exportPolicy value to set + * @return the VolumePatch object itself. + */ + public VolumePatch withExportPolicy(VolumePatchPropertiesExportPolicy exportPolicy) { + this.exportPolicy = exportPolicy; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatchPropertiesExportPolicy.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatchPropertiesExportPolicy.java new file mode 100644 index 000000000000..ee4590984f85 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePatchPropertiesExportPolicy.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * exportPolicy. + * Set of export policy rules. + */ +public class VolumePatchPropertiesExportPolicy { + /** + * Export policy rule. + * Export policy rule. + */ + @JsonProperty(value = "rules") + private List rules; + + /** + * Get export policy rule. + * + * @return the rules value + */ + public List rules() { + return this.rules; + } + + /** + * Set export policy rule. + * + * @param rules the rules value to set + * @return the VolumePatchPropertiesExportPolicy object itself. + */ + public VolumePatchPropertiesExportPolicy withRules(List rules) { + this.rules = rules; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesDataProtection.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesDataProtection.java new file mode 100644 index 000000000000..ae6057c1edc0 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesDataProtection.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * DataProtection. + * DataProtection type volumes include an object containing details of the + * replication. + */ +public class VolumePropertiesDataProtection { + /** + * Replication. + * Replication properties. + */ + @JsonProperty(value = "replication") + private ReplicationObject replication; + + /** + * Get replication properties. + * + * @return the replication value + */ + public ReplicationObject replication() { + return this.replication; + } + + /** + * Set replication properties. + * + * @param replication the replication value to set + * @return the VolumePropertiesDataProtection object itself. + */ + public VolumePropertiesDataProtection withReplication(ReplicationObject replication) { + this.replication = replication; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesExportPolicy.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesExportPolicy.java new file mode 100644 index 000000000000..f6a240f12e24 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/VolumePropertiesExportPolicy.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * exportPolicy. + * Set of export policy rules. + */ +public class VolumePropertiesExportPolicy { + /** + * Export policy rule. + * Export policy rule. + */ + @JsonProperty(value = "rules") + private List rules; + + /** + * Get export policy rule. + * + * @return the rules value + */ + public List rules() { + return this.rules; + } + + /** + * Set export policy rule. + * + * @param rules the rules value to set + * @return the VolumePropertiesExportPolicy object itself. + */ + public VolumePropertiesExportPolicy withRules(List rules) { + this.rules = rules; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volumes.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volumes.java new file mode 100644 index 000000000000..30573d9b866c --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/Volumes.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.implementation.VolumesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Volumes. + */ +public interface Volumes extends SupportsCreating, HasInner { + /** + * Break volume replication. + * Break the replication connection on the destination volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable breakReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Resync volume replication. + * Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from source to destination. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable resyncReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Delete volume replication. + * Delete the replication connection on the destination volume, and send release to the source replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable authorizeReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Describe a volume. + * Get the details of the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Describe all volumes. + * List all volumes within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String accountName, String poolName); + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Get volume replication status. + * Get the status of the replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable replicationStatusMethodAsync(String resourceGroupName, String accountName, String poolName, String volumeName); + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsImpl.java new file mode 100644 index 000000000000..fde618e6971a --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsImpl.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.Accounts; +import com.microsoft.azure.management.netapp.v2019_10_01.NetAppAccount; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class AccountsImpl extends GroupableResourcesCoreImpl implements Accounts { + protected AccountsImpl(NetAppManager manager) { + super(manager.inner().accounts(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + AccountsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + AccountsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + AccountsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + AccountsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public NetAppAccount call(NetAppAccountInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public NetAppAccountImpl define(String name) { + return wrapModel(name); + } + + @Override + protected NetAppAccountImpl wrapModel(NetAppAccountInner inner) { + return new NetAppAccountImpl(inner.name(), inner, manager()); + } + + @Override + protected NetAppAccountImpl wrapModel(String name) { + return new NetAppAccountImpl(name, new NetAppAccountInner(), this.manager()); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsInner.java new file mode 100644 index 000000000000..d86eedb2153f --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AccountsInner.java @@ -0,0 +1,719 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.netapp.v2019_10_01.NetAppAccountPatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Accounts. + */ +public class AccountsInner implements InnerSupportsGet, InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private AccountsService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of AccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AccountsInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(AccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Accounts to be + * used by Retrofit to perform actually REST calls. + */ + interface AccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Body NetAppAccountInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Body NetAppAccountInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Accounts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Body NetAppAccountPatch body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Describe all NetApp Accounts in a resource group. + * List and describe all NetApp accounts in the resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Describe all NetApp Accounts in a resource group. + * List and describe all NetApp accounts in the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Describe all NetApp Accounts in a resource group. + * List and describe all NetApp accounts in the resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<NetAppAccountInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Describe all NetApp Accounts in a resource group. + * List and describe all NetApp accounts in the resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<NetAppAccountInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Describe a NetApp Account. + * Get the NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetAppAccountInner object if successful. + */ + public NetAppAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Describe a NetApp Account. + * Get the NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Describe a NetApp Account. + * Get the NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetAppAccountInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, NetAppAccountInner>() { + @Override + public NetAppAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Describe a NetApp Account. + * Get the NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetAppAccountInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetAppAccountInner object if successful. + */ + public NetAppAccountInner createOrUpdate(String resourceGroupName, String accountName, NetAppAccountInner body) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body).toBlocking().last().body(); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String accountName, NetAppAccountInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body), serviceCallback); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, NetAppAccountInner body) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body).map(new Func1, NetAppAccountInner>() { + @Override + public NetAppAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, NetAppAccountInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetAppAccountInner object if successful. + */ + public NetAppAccountInner beginCreateOrUpdate(String resourceGroupName, String accountName, NetAppAccountInner body) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body).toBlocking().single().body(); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String accountName, NetAppAccountInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body), serviceCallback); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetAppAccountInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String accountName, NetAppAccountInner body) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body).map(new Func1, NetAppAccountInner>() { + @Override + public NetAppAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a NetApp account. + * Create or update the specified NetApp account within the resource group. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetAppAccountInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, NetAppAccountInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().last().body(); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String accountName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a NetApp account. + * Delete the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a NetApp account. + * Patch the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetAppAccountInner object if successful. + */ + public NetAppAccountInner update(String resourceGroupName, String accountName, NetAppAccountPatch body) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, body).toBlocking().single().body(); + } + + /** + * Update a NetApp account. + * Patch the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, NetAppAccountPatch body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, body), serviceCallback); + } + + /** + * Update a NetApp account. + * Patch the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetAppAccountInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, NetAppAccountPatch body) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, body).map(new Func1, NetAppAccountInner>() { + @Override + public NetAppAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a NetApp account. + * Patch the specified NetApp account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param body NetApp Account object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetAppAccountInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, NetAppAccountPatch body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.update(this.client.subscriptionId(), resourceGroupName, accountName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AzureNetAppFilesManagementClientImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AzureNetAppFilesManagementClientImpl.java new file mode 100644 index 000000000000..65a003fe71e6 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/AzureNetAppFilesManagementClientImpl.java @@ -0,0 +1,280 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AzureNetAppFilesManagementClientImpl class. + */ +public class AzureNetAppFilesManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AzureNetAppFilesManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of the API to be used with the client request. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AzureNetAppFilesManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AzureNetAppFilesManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AzureNetAppFilesManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The NetAppResourcesInner object to access its operations. + */ + private NetAppResourcesInner netAppResources; + + /** + * Gets the NetAppResourcesInner object to access its operations. + * @return the NetAppResourcesInner object. + */ + public NetAppResourcesInner netAppResources() { + return this.netAppResources; + } + + /** + * The AccountsInner object to access its operations. + */ + private AccountsInner accounts; + + /** + * Gets the AccountsInner object to access its operations. + * @return the AccountsInner object. + */ + public AccountsInner accounts() { + return this.accounts; + } + + /** + * The PoolsInner object to access its operations. + */ + private PoolsInner pools; + + /** + * Gets the PoolsInner object to access its operations. + * @return the PoolsInner object. + */ + public PoolsInner pools() { + return this.pools; + } + + /** + * The VolumesInner object to access its operations. + */ + private VolumesInner volumes; + + /** + * Gets the VolumesInner object to access its operations. + * @return the VolumesInner object. + */ + public VolumesInner volumes() { + return this.volumes; + } + + /** + * The MountTargetsInner object to access its operations. + */ + private MountTargetsInner mountTargets; + + /** + * Gets the MountTargetsInner object to access its operations. + * @return the MountTargetsInner object. + */ + public MountTargetsInner mountTargets() { + return this.mountTargets; + } + + /** + * The SnapshotsInner object to access its operations. + */ + private SnapshotsInner snapshots; + + /** + * Gets the SnapshotsInner object to access its operations. + * @return the SnapshotsInner object. + */ + public SnapshotsInner snapshots() { + return this.snapshots; + } + + /** + * Initializes an instance of AzureNetAppFilesManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AzureNetAppFilesManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AzureNetAppFilesManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AzureNetAppFilesManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AzureNetAppFilesManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AzureNetAppFilesManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-10-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.netAppResources = new NetAppResourcesInner(restClient().retrofit(), this); + this.accounts = new AccountsInner(restClient().retrofit(), this); + this.pools = new PoolsInner(restClient().retrofit(), this); + this.volumes = new VolumesInner(restClient().retrofit(), this); + this.mountTargets = new MountTargetsInner(restClient().retrofit(), this); + this.snapshots = new SnapshotsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "AzureNetAppFilesManagementClient", "2019-10-01"); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolImpl.java new file mode 100644 index 000000000000..0e4e53654e91 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolImpl.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.CapacityPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.CapacityPoolPatch; +import com.microsoft.azure.management.netapp.v2019_10_01.ServiceLevel; +import java.util.Map; +import rx.functions.Func1; + +class CapacityPoolImpl extends CreatableUpdatableImpl implements CapacityPool, CapacityPool.Definition, CapacityPool.Update { + private final NetAppManager manager; + private String resourceGroupName; + private String accountName; + private String poolName; + private CapacityPoolPatch updateParameter; + + CapacityPoolImpl(String name, NetAppManager manager) { + super(name, new CapacityPoolInner()); + this.manager = manager; + // Set resource name + this.poolName = name; + // + this.updateParameter = new CapacityPoolPatch(); + } + + CapacityPoolImpl(CapacityPoolInner inner, NetAppManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.poolName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "netAppAccounts"); + this.poolName = IdParsingUtils.getValueFromIdByName(inner.id(), "capacityPools"); + // + this.updateParameter = new CapacityPoolPatch(); + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PoolsInner client = this.manager().inner().pools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.poolName, this.inner()) + .map(new Func1() { + @Override + public CapacityPoolInner call(CapacityPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PoolsInner client = this.manager().inner().pools(); + return client.updateAsync(this.resourceGroupName, this.accountName, this.poolName, this.updateParameter) + .map(new Func1() { + @Override + public CapacityPoolInner call(CapacityPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PoolsInner client = this.manager().inner().pools(); + return client.getAsync(this.resourceGroupName, this.accountName, this.poolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new CapacityPoolPatch(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String poolId() { + return this.inner().poolId(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ServiceLevel serviceLevel() { + return this.inner().serviceLevel(); + } + + @Override + public long size() { + return this.inner().size(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public CapacityPoolImpl withExistingNetAppAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public CapacityPoolImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public CapacityPoolImpl withSize(long size) { + this.inner().withSize(size); + return this; + } + + @Override + public CapacityPoolImpl withSize(Long size) { + this.updateParameter.withSize(size); + return this; + } + + @Override + public CapacityPoolImpl withServiceLevel(ServiceLevel serviceLevel) { + if (isInCreateMode()) { + this.inner().withServiceLevel(serviceLevel); + } else { + this.updateParameter.withServiceLevel(serviceLevel); + } + return this; + } + + @Override + public CapacityPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolInner.java new file mode 100644 index 000000000000..743ac1884044 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/CapacityPoolInner.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.ServiceLevel; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Capacity pool resource. + */ +@JsonFlatten +public class CapacityPoolInner extends Resource { + /** + * poolId. + * UUID v4 used to identify the Pool. + */ + @JsonProperty(value = "properties.poolId", access = JsonProperty.Access.WRITE_ONLY) + private String poolId; + + /** + * size. + * Provisioned size of the pool (in bytes). Allowed values are in 4TiB + * chunks (value must be multiply of 4398046511104). + */ + @JsonProperty(value = "properties.size", required = true) + private long size; + + /** + * serviceLevel. + * The service level of the file system. Possible values include: + * 'Standard', 'Premium', 'Ultra'. + */ + @JsonProperty(value = "properties.serviceLevel", required = true) + private ServiceLevel serviceLevel; + + /** + * Azure lifecycle management. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get uUID v4 used to identify the Pool. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Get provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + * + * @return the size value + */ + public long size() { + return this.size; + } + + /** + * Set provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + * + * @param size the size value to set + * @return the CapacityPoolInner object itself. + */ + public CapacityPoolInner withSize(long size) { + this.size = size; + return this; + } + + /** + * Get the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @return the serviceLevel value + */ + public ServiceLevel serviceLevel() { + return this.serviceLevel; + } + + /** + * Set the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @param serviceLevel the serviceLevel value to set + * @return the CapacityPoolInner object itself. + */ + public CapacityPoolInner withServiceLevel(ServiceLevel serviceLevel) { + this.serviceLevel = serviceLevel; + return this; + } + + /** + * Get azure lifecycle management. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/IdParsingUtils.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..3d0693510bf1 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetImpl.java new file mode 100644 index 000000000000..a6f6c1843898 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetImpl.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.MountTarget; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.Map; + +class MountTargetImpl extends WrapperImpl implements MountTarget { + private final NetAppManager manager; + + MountTargetImpl(MountTargetInner inner, NetAppManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + + + @Override + public String endIp() { + return this.inner().endIp(); + } + + @Override + public String fileSystemId() { + return this.inner().fileSystemId(); + } + + @Override + public String gateway() { + return this.inner().gateway(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String ipAddress() { + return this.inner().ipAddress(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String mountTargetId() { + return this.inner().mountTargetId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String netmask() { + return this.inner().netmask(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String smbServerFqdn() { + return this.inner().smbServerFqdn(); + } + + @Override + public String startIp() { + return this.inner().startIp(); + } + + @Override + public String subnet() { + return this.inner().subnet(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetInner.java new file mode 100644 index 000000000000..0173b775a483 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetInner.java @@ -0,0 +1,355 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Mount Target. + */ +@JsonFlatten +public class MountTargetInner { + /** + * Resource location. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Resource Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * mountTargetId. + * UUID v4 used to identify the MountTarget. + */ + @JsonProperty(value = "properties.mountTargetId", access = JsonProperty.Access.WRITE_ONLY) + private String mountTargetId; + + /** + * fileSystemId. + * UUID v4 used to identify the MountTarget. + */ + @JsonProperty(value = "properties.fileSystemId", required = true) + private String fileSystemId; + + /** + * ipAddress. + * The mount target's IPv4 address. + */ + @JsonProperty(value = "properties.ipAddress", access = JsonProperty.Access.WRITE_ONLY) + private String ipAddress; + + /** + * subnet. + * The subnet. + */ + @JsonProperty(value = "properties.subnet") + private String subnet; + + /** + * startIp. + * The start of IPv4 address range to use when creating a new mount target. + */ + @JsonProperty(value = "properties.startIp") + private String startIp; + + /** + * endIp. + * The end of IPv4 address range to use when creating a new mount target. + */ + @JsonProperty(value = "properties.endIp") + private String endIp; + + /** + * gateway. + * The gateway of the IPv4 address range to use when creating a new mount + * target. + */ + @JsonProperty(value = "properties.gateway") + private String gateway; + + /** + * netmask. + * The netmask of the IPv4 address range to use when creating a new mount + * target. + */ + @JsonProperty(value = "properties.netmask") + private String netmask; + + /** + * smbServerFQDN. + * The SMB server's Fully Qualified Domain Name, FQDN. + */ + @JsonProperty(value = "properties.smbServerFqdn") + private String smbServerFqdn; + + /** + * Azure lifecycle management. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get uUID v4 used to identify the MountTarget. + * + * @return the mountTargetId value + */ + public String mountTargetId() { + return this.mountTargetId; + } + + /** + * Get uUID v4 used to identify the MountTarget. + * + * @return the fileSystemId value + */ + public String fileSystemId() { + return this.fileSystemId; + } + + /** + * Set uUID v4 used to identify the MountTarget. + * + * @param fileSystemId the fileSystemId value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withFileSystemId(String fileSystemId) { + this.fileSystemId = fileSystemId; + return this; + } + + /** + * Get the mount target's IPv4 address. + * + * @return the ipAddress value + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Get the subnet. + * + * @return the subnet value + */ + public String subnet() { + return this.subnet; + } + + /** + * Set the subnet. + * + * @param subnet the subnet value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withSubnet(String subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the start of IPv4 address range to use when creating a new mount target. + * + * @return the startIp value + */ + public String startIp() { + return this.startIp; + } + + /** + * Set the start of IPv4 address range to use when creating a new mount target. + * + * @param startIp the startIp value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withStartIp(String startIp) { + this.startIp = startIp; + return this; + } + + /** + * Get the end of IPv4 address range to use when creating a new mount target. + * + * @return the endIp value + */ + public String endIp() { + return this.endIp; + } + + /** + * Set the end of IPv4 address range to use when creating a new mount target. + * + * @param endIp the endIp value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withEndIp(String endIp) { + this.endIp = endIp; + return this; + } + + /** + * Get the gateway of the IPv4 address range to use when creating a new mount target. + * + * @return the gateway value + */ + public String gateway() { + return this.gateway; + } + + /** + * Set the gateway of the IPv4 address range to use when creating a new mount target. + * + * @param gateway the gateway value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withGateway(String gateway) { + this.gateway = gateway; + return this; + } + + /** + * Get the netmask of the IPv4 address range to use when creating a new mount target. + * + * @return the netmask value + */ + public String netmask() { + return this.netmask; + } + + /** + * Set the netmask of the IPv4 address range to use when creating a new mount target. + * + * @param netmask the netmask value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withNetmask(String netmask) { + this.netmask = netmask; + return this; + } + + /** + * Get the SMB server's Fully Qualified Domain Name, FQDN. + * + * @return the smbServerFqdn value + */ + public String smbServerFqdn() { + return this.smbServerFqdn; + } + + /** + * Set the SMB server's Fully Qualified Domain Name, FQDN. + * + * @param smbServerFqdn the smbServerFqdn value to set + * @return the MountTargetInner object itself. + */ + public MountTargetInner withSmbServerFqdn(String smbServerFqdn) { + this.smbServerFqdn = smbServerFqdn; + return this; + } + + /** + * Get azure lifecycle management. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsImpl.java new file mode 100644 index 000000000000..ad5d93fd4dcb --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.MountTargets; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.MountTarget; + +class MountTargetsImpl extends WrapperImpl implements MountTargets { + private final NetAppManager manager; + + MountTargetsImpl(NetAppManager manager) { + super(manager.inner().mountTargets()); + this.manager = manager; + } + + public NetAppManager manager() { + return this.manager; + } + + private MountTargetImpl wrapModel(MountTargetInner inner) { + return new MountTargetImpl(inner, manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + MountTargetsInner client = this.inner(); + return client.listAsync(resourceGroupName, accountName, poolName, volumeName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public MountTarget call(MountTargetInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsInner.java new file mode 100644 index 000000000000..295ce1ca537d --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/MountTargetsInner.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MountTargets. + */ +public class MountTargetsInner { + /** The Retrofit service to perform REST calls. */ + private MountTargetsService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of MountTargetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MountTargetsInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(MountTargetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MountTargets to be + * used by Retrofit to perform actually REST calls. + */ + interface MountTargetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.MountTargets list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/mountTargets") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Describe all mount targets. + * List all mount targets associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MountTargetInner> object if successful. + */ + public List list(String resourceGroupName, String accountName, String poolName, String volumeName) { + return listWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Describe all mount targets. + * List all mount targets associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Describe all mount targets. + * List all mount targets associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MountTargetInner> object + */ + public Observable> listAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return listWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Describe all mount targets. + * List all mount targets associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MountTargetInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountImpl.java new file mode 100644 index 000000000000..56f5e4fff118 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.NetAppAccount; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.NetAppAccountPatch; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.ActiveDirectory; +import rx.functions.Func1; + +class NetAppAccountImpl extends GroupableResourceCoreImpl implements NetAppAccount, NetAppAccount.Definition, NetAppAccount.Update { + private NetAppAccountPatch updateParameter; + NetAppAccountImpl(String name, NetAppAccountInner inner, NetAppManager manager) { + super(name, inner, manager); + this.updateParameter = new NetAppAccountPatch(); + } + + @Override + public Observable createResourceAsync() { + AccountsInner client = this.manager().inner().accounts(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public NetAppAccountInner call(NetAppAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + AccountsInner client = this.manager().inner().accounts(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public NetAppAccountInner call(NetAppAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + AccountsInner client = this.manager().inner().accounts(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new NetAppAccountPatch(); + } + + @Override + public List activeDirectories() { + return this.inner().activeDirectories(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public NetAppAccountImpl withActiveDirectories(List activeDirectories) { + if (isInCreateMode()) { + this.inner().withActiveDirectories(activeDirectories); + } else { + this.updateParameter.withActiveDirectories(activeDirectories); + } + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountInner.java new file mode 100644 index 000000000000..03c11a1145db --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppAccountInner.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.ActiveDirectory; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * NetApp account resource. + */ +@JsonFlatten +public class NetAppAccountInner extends Resource { + /** + * Azure lifecycle management. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Active Directories. + */ + @JsonProperty(value = "properties.activeDirectories") + private List activeDirectories; + + /** + * Get azure lifecycle management. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get active Directories. + * + * @return the activeDirectories value + */ + public List activeDirectories() { + return this.activeDirectories; + } + + /** + * Set active Directories. + * + * @param activeDirectories the activeDirectories value to set + * @return the NetAppAccountInner object itself. + */ + public NetAppAccountInner withActiveDirectories(List activeDirectories) { + this.activeDirectories = activeDirectories; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppManager.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppManager.java new file mode 100644 index 000000000000..31a240121091 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppManager.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.netapp.v2019_10_01.Operations; +import com.microsoft.azure.management.netapp.v2019_10_01.NetAppResources; +import com.microsoft.azure.management.netapp.v2019_10_01.Accounts; +import com.microsoft.azure.management.netapp.v2019_10_01.Pools; +import com.microsoft.azure.management.netapp.v2019_10_01.Volumes; +import com.microsoft.azure.management.netapp.v2019_10_01.MountTargets; +import com.microsoft.azure.management.netapp.v2019_10_01.Snapshots; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure NetApp resource management. + */ +public final class NetAppManager extends ManagerCore { + private Operations operations; + private NetAppResources netAppResources; + private Accounts accounts; + private Pools pools; + private Volumes volumes; + private MountTargets mountTargets; + private Snapshots snapshots; + /** + * Get a Configurable instance that can be used to create NetAppManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new NetAppManager.ConfigurableImpl(); + } + /** + * Creates an instance of NetAppManager that exposes NetApp resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the NetAppManager + */ + public static NetAppManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new NetAppManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of NetAppManager that exposes NetApp resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the NetAppManager + */ + public static NetAppManager authenticate(RestClient restClient, String subscriptionId) { + return new NetAppManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of NetAppManager that exposes NetApp management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing NetApp management API entry points that work across subscriptions + */ + NetAppManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage NetAppResources. + */ + public NetAppResources netAppResources() { + if (this.netAppResources == null) { + this.netAppResources = new NetAppResourcesImpl(this); + } + return this.netAppResources; + } + + /** + * @return Entry point to manage Accounts. + */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(this); + } + return this.accounts; + } + + /** + * @return Entry point to manage Pools. + */ + public Pools pools() { + if (this.pools == null) { + this.pools = new PoolsImpl(this); + } + return this.pools; + } + + /** + * @return Entry point to manage Volumes. + */ + public Volumes volumes() { + if (this.volumes == null) { + this.volumes = new VolumesImpl(this); + } + return this.volumes; + } + + /** + * @return Entry point to manage MountTargets. + */ + public MountTargets mountTargets() { + if (this.mountTargets == null) { + this.mountTargets = new MountTargetsImpl(this); + } + return this.mountTargets; + } + + /** + * @return Entry point to manage Snapshots. + */ + public Snapshots snapshots() { + if (this.snapshots == null) { + this.snapshots = new SnapshotsImpl(this); + } + return this.snapshots; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public NetAppManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return NetAppManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private NetAppManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new AzureNetAppFilesManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesImpl.java new file mode 100644 index 000000000000..1ce372fb34fb --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesImpl.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.NetAppResources; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.ResourceNameAvailability; +import com.microsoft.azure.management.netapp.v2019_10_01.CheckNameResourceTypes; + +class NetAppResourcesImpl extends WrapperImpl implements NetAppResources { + private final NetAppManager manager; + + NetAppResourcesImpl(NetAppManager manager) { + super(manager.inner().netAppResources()); + this.manager = manager; + } + + public NetAppManager manager() { + return this.manager; + } + + @Override + public Observable checkNameAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + NetAppResourcesInner client = this.inner(); + return client.checkNameAvailabilityAsync(location, name, type, resourceGroup) + .map(new Func1() { + @Override + public ResourceNameAvailability call(ResourceNameAvailabilityInner inner) { + return new ResourceNameAvailabilityImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkFilePathAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + NetAppResourcesInner client = this.inner(); + return client.checkFilePathAvailabilityAsync(location, name, type, resourceGroup) + .map(new Func1() { + @Override + public ResourceNameAvailability call(ResourceNameAvailabilityInner inner) { + return new ResourceNameAvailabilityImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesInner.java new file mode 100644 index 000000000000..5f57c4809fc5 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/NetAppResourcesInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.netapp.v2019_10_01.CheckNameResourceTypes; +import com.microsoft.azure.management.netapp.v2019_10_01.ResourceNameAvailabilityRequest; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in NetAppResources. + */ +public class NetAppResourcesInner { + /** The Retrofit service to perform REST calls. */ + private NetAppResourcesService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of NetAppResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NetAppResourcesInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(NetAppResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for NetAppResources to be + * used by Retrofit to perform actually REST calls. + */ + interface NetAppResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.NetAppResources checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ResourceNameAvailabilityRequest body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.NetAppResources checkFilePathAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability") + Observable> checkFilePathAvailability(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ResourceNameAvailabilityRequest body, @Header("User-Agent") String userAgent); + + } + + /** + * Check resource name availability. + * Check if a resource name is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceNameAvailabilityInner object if successful. + */ + public ResourceNameAvailabilityInner checkNameAvailability(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + return checkNameAvailabilityWithServiceResponseAsync(location, name, type, resourceGroup).toBlocking().single().body(); + } + + /** + * Check resource name availability. + * Check if a resource name is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(location, name, type, resourceGroup), serviceCallback); + } + + /** + * Check resource name availability. + * Check if a resource name is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceNameAvailabilityInner object + */ + public Observable checkNameAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + return checkNameAvailabilityWithServiceResponseAsync(location, name, type, resourceGroup).map(new Func1, ResourceNameAvailabilityInner>() { + @Override + public ResourceNameAvailabilityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check resource name availability. + * Check if a resource name is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceNameAvailabilityInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + ResourceNameAvailabilityRequest body = new ResourceNameAvailabilityRequest(); + body.withName(name); + body.withType(type); + body.withResourceGroup(resourceGroup); + return service.checkNameAvailability(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Check file path availability. + * Check if a file path is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceNameAvailabilityInner object if successful. + */ + public ResourceNameAvailabilityInner checkFilePathAvailability(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + return checkFilePathAvailabilityWithServiceResponseAsync(location, name, type, resourceGroup).toBlocking().single().body(); + } + + /** + * Check file path availability. + * Check if a file path is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkFilePathAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkFilePathAvailabilityWithServiceResponseAsync(location, name, type, resourceGroup), serviceCallback); + } + + /** + * Check file path availability. + * Check if a file path is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceNameAvailabilityInner object + */ + public Observable checkFilePathAvailabilityAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + return checkFilePathAvailabilityWithServiceResponseAsync(location, name, type, resourceGroup).map(new Func1, ResourceNameAvailabilityInner>() { + @Override + public ResourceNameAvailabilityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check file path availability. + * Check if a file path is available. + * + * @param location The location + * @param name Resource name to verify. + * @param type Resource type used for verification. Possible values include: 'Microsoft.NetApp/netAppAccounts', 'Microsoft.NetApp/netAppAccounts/capacityPools', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes', 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots' + * @param resourceGroup Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceNameAvailabilityInner object + */ + public Observable> checkFilePathAvailabilityWithServiceResponseAsync(String location, String name, CheckNameResourceTypes type, String resourceGroup) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + ResourceNameAvailabilityRequest body = new ResourceNameAvailabilityRequest(); + body.withName(name); + body.withType(type); + body.withResourceGroup(resourceGroup); + return service.checkFilePathAvailability(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkFilePathAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkFilePathAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..510609035663 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationImpl.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.OperationDisplay; +import com.microsoft.azure.management.netapp.v2019_10_01.ServiceSpecification; + +class OperationImpl extends WrapperImpl implements Operation { + private final NetAppManager manager; + OperationImpl(OperationInner inner, NetAppManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public ServiceSpecification serviceSpecification() { + return this.inner().serviceSpecification(); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationInner.java new file mode 100644 index 000000000000..25add61f5260 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.OperationDisplay; +import com.microsoft.azure.management.netapp.v2019_10_01.ServiceSpecification; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Microsoft.NetApp REST API operation definition. + */ +@JsonFlatten +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * The origin of operations. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * One property of operation, include metric specifications. + */ + @JsonProperty(value = "properties.serviceSpecification") + private ServiceSpecification serviceSpecification; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the 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 of operations. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin of operations. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get one property of operation, include metric specifications. + * + * @return the serviceSpecification value + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set one property of operation, include metric specifications. + * + * @param serviceSpecification the serviceSpecification value to set + * @return the OperationInner object itself. + */ + public OperationInner withServiceSpecification(ServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..024b45ebd640 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final NetAppManager manager; + + OperationsImpl(NetAppManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public NetAppManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..0f3a4974edc6 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/OperationsInner.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Operations list" }) + @GET("providers/Microsoft.NetApp/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Describes the Resource Provider. + * Lists all of the available Microsoft.NetApp Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<OperationInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Describes the Resource Provider. + * Lists all of the available Microsoft.NetApp Rest API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Describes the Resource Provider. + * Lists all of the available Microsoft.NetApp Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Describes the Resource Provider. + * Lists all of the available Microsoft.NetApp Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PageImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PageImpl.java new file mode 100644 index 000000000000..509333ab8cc2 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsImpl.java new file mode 100644 index 000000000000..96332363d50c --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.Pools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.CapacityPool; + +class PoolsImpl extends WrapperImpl implements Pools { + private final NetAppManager manager; + + PoolsImpl(NetAppManager manager) { + super(manager.inner().pools()); + this.manager = manager; + } + + public NetAppManager manager() { + return this.manager; + } + + @Override + public CapacityPoolImpl define(String name) { + return wrapModel(name); + } + + private CapacityPoolImpl wrapModel(CapacityPoolInner inner) { + return new CapacityPoolImpl(inner, manager()); + } + + private CapacityPoolImpl wrapModel(String name) { + return new CapacityPoolImpl(name, this.manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String accountName) { + PoolsInner client = this.inner(); + return client.listAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CapacityPool call(CapacityPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String poolName) { + PoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, poolName) + .flatMap(new Func1>() { + @Override + public Observable call(CapacityPoolInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((CapacityPool)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String poolName) { + PoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, poolName).toCompletable(); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsInner.java new file mode 100644 index 000000000000..d111d54b6a47 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/PoolsInner.java @@ -0,0 +1,760 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.netapp.v2019_10_01.CapacityPoolPatch; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Pools. + */ +public class PoolsInner { + /** The Retrofit service to perform REST calls. */ + private PoolsService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of PoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoolsInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(PoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Pools to be + * used by Retrofit to perform actually REST calls. + */ + interface PoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Body CapacityPoolInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Body CapacityPoolInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Body CapacityPoolPatch body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Pools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Describe all Capacity Pools. + * List all capacity pools in the NetApp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<CapacityPoolInner> object if successful. + */ + public List list(String resourceGroupName, String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Describe all Capacity Pools. + * List all capacity pools in the NetApp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Describe all Capacity Pools. + * List all capacity pools in the NetApp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<CapacityPoolInner> object + */ + public Observable> listAsync(String resourceGroupName, String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Describe all Capacity Pools. + * List all capacity pools in the NetApp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<CapacityPoolInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Describe a Capacity Pool. + * Get details of the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CapacityPoolInner object if successful. + */ + public CapacityPoolInner get(String resourceGroupName, String accountName, String poolName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, poolName).toBlocking().single().body(); + } + + /** + * Describe a Capacity Pool. + * Get details of the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String poolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, poolName), serviceCallback); + } + + /** + * Describe a Capacity Pool. + * Get details of the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapacityPoolInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String poolName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, poolName).map(new Func1, CapacityPoolInner>() { + @Override + public CapacityPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Describe a Capacity Pool. + * Get details of the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapacityPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, accountName, poolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CapacityPoolInner object if successful. + */ + public CapacityPoolInner createOrUpdate(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body).toBlocking().last().body(); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body), serviceCallback); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body).map(new Func1, CapacityPoolInner>() { + @Override + public CapacityPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CapacityPoolInner object if successful. + */ + public CapacityPoolInner beginCreateOrUpdate(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body).toBlocking().single().body(); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body), serviceCallback); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapacityPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body).map(new Func1, CapacityPoolInner>() { + @Override + public CapacityPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update the specified capacity pool within the resource group. + * Create or Update a capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapacityPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a capacity pool. + * Patch the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CapacityPoolInner object if successful. + */ + public CapacityPoolInner update(String resourceGroupName, String accountName, String poolName, CapacityPoolPatch body) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body).toBlocking().single().body(); + } + + /** + * Update a capacity pool. + * Patch the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolPatch body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body), serviceCallback); + } + + /** + * Update a capacity pool. + * Patch the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapacityPoolInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolPatch body) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, body).map(new Func1, CapacityPoolInner>() { + @Override + public CapacityPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a capacity pool. + * Patch the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param body Capacity pool object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapacityPoolInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, CapacityPoolPatch body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.update(this.client.subscriptionId(), resourceGroupName, accountName, poolName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName, String poolName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName).toBlocking().last().body(); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, String poolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName), serviceCallback); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String poolName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, poolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String accountName, String poolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName).toBlocking().single().body(); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String accountName, String poolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName), serviceCallback); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName, String poolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a capacity pool. + * Delete the specified capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, poolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusImpl.java new file mode 100644 index 000000000000..2b996deb0b8e --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.ReplicationStatus; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.MirrorState; +import com.microsoft.azure.management.netapp.v2019_10_01.RelationshipStatus; + +class ReplicationStatusImpl extends WrapperImpl implements ReplicationStatus { + private final NetAppManager manager; + ReplicationStatusImpl(ReplicationStatusInner inner, NetAppManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Boolean healthy() { + return this.inner().healthy(); + } + + @Override + public MirrorState mirrorState() { + return this.inner().mirrorState(); + } + + @Override + public RelationshipStatus relationshipStatus() { + return this.inner().relationshipStatus(); + } + + @Override + public String totalProgress() { + return this.inner().totalProgress(); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusInner.java new file mode 100644 index 000000000000..1bec2b3e1ae7 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ReplicationStatusInner.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.RelationshipStatus; +import com.microsoft.azure.management.netapp.v2019_10_01.MirrorState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Replication status. + */ +public class ReplicationStatusInner { + /** + * Replication health check. + */ + @JsonProperty(value = "healthy") + private Boolean healthy; + + /** + * Status of the mirror relationship. Possible values include: 'Idle', + * 'Transferring'. + */ + @JsonProperty(value = "relationshipStatus") + private RelationshipStatus relationshipStatus; + + /** + * The status of the replication. Possible values include: 'Uninitialized', + * 'Mirrored', 'Broken'. + */ + @JsonProperty(value = "mirrorState") + private MirrorState mirrorState; + + /** + * The progress of the replication. + */ + @JsonProperty(value = "totalProgress") + private String totalProgress; + + /** + * Displays error message if the replication is in an error state. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /** + * Get replication health check. + * + * @return the healthy value + */ + public Boolean healthy() { + return this.healthy; + } + + /** + * Set replication health check. + * + * @param healthy the healthy value to set + * @return the ReplicationStatusInner object itself. + */ + public ReplicationStatusInner withHealthy(Boolean healthy) { + this.healthy = healthy; + return this; + } + + /** + * Get status of the mirror relationship. Possible values include: 'Idle', 'Transferring'. + * + * @return the relationshipStatus value + */ + public RelationshipStatus relationshipStatus() { + return this.relationshipStatus; + } + + /** + * Set status of the mirror relationship. Possible values include: 'Idle', 'Transferring'. + * + * @param relationshipStatus the relationshipStatus value to set + * @return the ReplicationStatusInner object itself. + */ + public ReplicationStatusInner withRelationshipStatus(RelationshipStatus relationshipStatus) { + this.relationshipStatus = relationshipStatus; + return this; + } + + /** + * Get the status of the replication. Possible values include: 'Uninitialized', 'Mirrored', 'Broken'. + * + * @return the mirrorState value + */ + public MirrorState mirrorState() { + return this.mirrorState; + } + + /** + * Set the status of the replication. Possible values include: 'Uninitialized', 'Mirrored', 'Broken'. + * + * @param mirrorState the mirrorState value to set + * @return the ReplicationStatusInner object itself. + */ + public ReplicationStatusInner withMirrorState(MirrorState mirrorState) { + this.mirrorState = mirrorState; + return this; + } + + /** + * Get the progress of the replication. + * + * @return the totalProgress value + */ + public String totalProgress() { + return this.totalProgress; + } + + /** + * Set the progress of the replication. + * + * @param totalProgress the totalProgress value to set + * @return the ReplicationStatusInner object itself. + */ + public ReplicationStatusInner withTotalProgress(String totalProgress) { + this.totalProgress = totalProgress; + return this; + } + + /** + * Get displays error message if the replication is in an error state. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set displays error message if the replication is in an error state. + * + * @param errorMessage the errorMessage value to set + * @return the ReplicationStatusInner object itself. + */ + public ReplicationStatusInner withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityImpl.java new file mode 100644 index 000000000000..ed2aa5570616 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.ResourceNameAvailability; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.InAvailabilityReasonType; + +class ResourceNameAvailabilityImpl extends WrapperImpl implements ResourceNameAvailability { + private final NetAppManager manager; + ResourceNameAvailabilityImpl(ResourceNameAvailabilityInner inner, NetAppManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + @Override + public Boolean isAvailable() { + return this.inner().isAvailable(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public InAvailabilityReasonType reason() { + return this.inner().reason(); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityInner.java new file mode 100644 index 000000000000..9dcda1c75c41 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/ResourceNameAvailabilityInner.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.InAvailabilityReasonType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information regarding availability of a resource name. + */ +public class ResourceNameAvailabilityInner { + /** + * <code>true</code> indicates name is valid and available. + * <code>false</code> indicates the name is invalid, + * unavailable, or both. + */ + @JsonProperty(value = "isAvailable") + private Boolean isAvailable; + + /** + * <code>Invalid</code> indicates the name provided does not + * match Azure App Service naming requirements. + * <code>AlreadyExists</code> indicates that the name is + * already in use and is therefore unavailable. Possible values include: + * 'Invalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason") + private InAvailabilityReasonType reason; + + /** + * If reason == invalid, provide the user with the reason why the given + * name is invalid, and provide the resource naming requirements so that + * the user can select a valid name. If reason == AlreadyExists, explain + * that resource name is already in use, and direct them to select a + * different name. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get <code>true</code> indicates name is valid and available. <code>false</code> indicates the name is invalid, unavailable, or both. + * + * @return the isAvailable value + */ + public Boolean isAvailable() { + return this.isAvailable; + } + + /** + * Set <code>true</code> indicates name is valid and available. <code>false</code> indicates the name is invalid, unavailable, or both. + * + * @param isAvailable the isAvailable value to set + * @return the ResourceNameAvailabilityInner object itself. + */ + public ResourceNameAvailabilityInner withIsAvailable(Boolean isAvailable) { + this.isAvailable = isAvailable; + return this; + } + + /** + * Get <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public InAvailabilityReasonType reason() { + return this.reason; + } + + /** + * Set <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @param reason the reason value to set + * @return the ResourceNameAvailabilityInner object itself. + */ + public ResourceNameAvailabilityInner withReason(InAvailabilityReasonType reason) { + this.reason = reason; + return this; + } + + /** + * Get if reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set if reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. + * + * @param message the message value to set + * @return the ResourceNameAvailabilityInner object itself. + */ + public ResourceNameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotImpl.java new file mode 100644 index 000000000000..e84d9ffb7beb --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotImpl.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.Snapshot; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.Map; + +class SnapshotImpl extends CreatableUpdatableImpl implements Snapshot, Snapshot.Definition, Snapshot.Update { + private final NetAppManager manager; + private String resourceGroupName; + private String accountName; + private String poolName; + private String volumeName; + private String snapshotName; + + SnapshotImpl(String name, NetAppManager manager) { + super(name, new SnapshotInner()); + this.manager = manager; + // Set resource name + this.snapshotName = name; + // + } + + SnapshotImpl(SnapshotInner inner, NetAppManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.snapshotName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "netAppAccounts"); + this.poolName = IdParsingUtils.getValueFromIdByName(inner.id(), "capacityPools"); + this.volumeName = IdParsingUtils.getValueFromIdByName(inner.id(), "volumes"); + this.snapshotName = IdParsingUtils.getValueFromIdByName(inner.id(), "snapshots"); + // + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SnapshotsInner client = this.manager().inner().snapshots(); + return client.createAsync(this.resourceGroupName, this.accountName, this.poolName, this.volumeName, this.snapshotName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SnapshotsInner client = this.manager().inner().snapshots(); + return client.createAsync(this.resourceGroupName, this.accountName, this.poolName, this.volumeName, this.snapshotName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SnapshotsInner client = this.manager().inner().snapshots(); + return client.getAsync(this.resourceGroupName, this.accountName, this.poolName, this.volumeName, this.snapshotName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime created() { + return this.inner().created(); + } + + @Override + public String fileSystemId() { + return this.inner().fileSystemId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String snapshotId() { + return this.inner().snapshotId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SnapshotImpl withExistingVolume(String resourceGroupName, String accountName, String poolName, String volumeName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.poolName = poolName; + this.volumeName = volumeName; + return this; + } + + @Override + public SnapshotImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public SnapshotImpl withFileSystemId(String fileSystemId) { + this.inner().withFileSystemId(fileSystemId); + return this; + } + + @Override + public SnapshotImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotInner.java new file mode 100644 index 000000000000..1153bfe25c63 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotInner.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Snapshot of a Volume. + */ +@JsonFlatten +public class SnapshotInner extends Resource { + /** + * snapshotId. + * UUID v4 used to identify the Snapshot. + */ + @JsonProperty(value = "properties.snapshotId", access = JsonProperty.Access.WRITE_ONLY) + private String snapshotId; + + /** + * fileSystemId. + * UUID v4 used to identify the FileSystem. + */ + @JsonProperty(value = "properties.fileSystemId") + private String fileSystemId; + + /** + * name. + * The creation date of the snapshot. + */ + @JsonProperty(value = "properties.created", access = JsonProperty.Access.WRITE_ONLY) + private DateTime created; + + /** + * Azure lifecycle management. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get uUID v4 used to identify the Snapshot. + * + * @return the snapshotId value + */ + public String snapshotId() { + return this.snapshotId; + } + + /** + * Get uUID v4 used to identify the FileSystem. + * + * @return the fileSystemId value + */ + public String fileSystemId() { + return this.fileSystemId; + } + + /** + * Set uUID v4 used to identify the FileSystem. + * + * @param fileSystemId the fileSystemId value to set + * @return the SnapshotInner object itself. + */ + public SnapshotInner withFileSystemId(String fileSystemId) { + this.fileSystemId = fileSystemId; + return this; + } + + /** + * Get the creation date of the snapshot. + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Get azure lifecycle management. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsImpl.java new file mode 100644 index 000000000000..9acf40a0d860 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.Snapshots; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.Snapshot; + +class SnapshotsImpl extends WrapperImpl implements Snapshots { + private final NetAppManager manager; + + SnapshotsImpl(NetAppManager manager) { + super(manager.inner().snapshots()); + this.manager = manager; + } + + public NetAppManager manager() { + return this.manager; + } + + @Override + public SnapshotImpl define(String name) { + return wrapModel(name); + } + + private SnapshotImpl wrapModel(SnapshotInner inner) { + return new SnapshotImpl(inner, manager()); + } + + private SnapshotImpl wrapModel(String name) { + return new SnapshotImpl(name, this.manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + SnapshotsInner client = this.inner(); + return client.listAsync(resourceGroupName, accountName, poolName, volumeName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Snapshot call(SnapshotInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + SnapshotsInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName) + .flatMap(new Func1>() { + @Override + public Observable call(SnapshotInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Snapshot)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + SnapshotsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).toCompletable(); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsInner.java new file mode 100644 index 000000000000..b51169eef0c7 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/SnapshotsInner.java @@ -0,0 +1,965 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.netapp.v2019_10_01.SnapshotPatch; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Snapshots. + */ +public class SnapshotsInner { + /** The Retrofit service to perform REST calls. */ + private SnapshotsService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of SnapshotsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SnapshotsInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(SnapshotsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Snapshots to be + * used by Retrofit to perform actually REST calls. + */ + interface SnapshotsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Path("snapshotName") String snapshotName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Path("snapshotName") String snapshotName, @Body SnapshotInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Path("snapshotName") String snapshotName, @Body SnapshotInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Path("snapshotName") String snapshotName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SnapshotPatch body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Path("snapshotName") String snapshotName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Snapshots beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Path("snapshotName") String snapshotName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Describe all snapshots. + * List all snapshots associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<SnapshotInner> object if successful. + */ + public List list(String resourceGroupName, String accountName, String poolName, String volumeName) { + return listWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Describe all snapshots. + * List all snapshots associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Describe all snapshots. + * List all snapshots associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SnapshotInner> object + */ + public Observable> listAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return listWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Describe all snapshots. + * List all snapshots associated with the volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SnapshotInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Describe a snapshot. + * Get details of the specified snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SnapshotInner object if successful. + */ + public SnapshotInner get(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).toBlocking().single().body(); + } + + /** + * Describe a snapshot. + * Get details of the specified snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName), serviceCallback); + } + + /** + * Describe a snapshot. + * Get details of the specified snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).map(new Func1, SnapshotInner>() { + @Override + public SnapshotInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Describe a snapshot. + * Get details of the specified snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SnapshotInner object if successful. + */ + public SnapshotInner create(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body) { + return createWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, body).toBlocking().last().body(); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, body), serviceCallback); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body) { + return createWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, body).map(new Func1, SnapshotInner>() { + @Override + public SnapshotInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SnapshotInner object if successful. + */ + public SnapshotInner beginCreate(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body) { + return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, body).toBlocking().single().body(); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, body), serviceCallback); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body) { + return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, body).map(new Func1, SnapshotInner>() { + @Override + public SnapshotInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a snapshot. + * Create the specified snapshot within the given volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param body Snapshot object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SnapshotInner object if successful. + */ + public SnapshotInner update(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).toBlocking().single().body(); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName), serviceCallback); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).map(new Func1, SnapshotInner>() { + @Override + public SnapshotInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + SnapshotPatch body = new SnapshotPatch(); + body.withTags(null); + return service.update(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SnapshotInner object if successful. + */ + public SnapshotInner update(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, tags).toBlocking().single().body(); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param tags Resource tags + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, tags), serviceCallback); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName, tags).map(new Func1, SnapshotInner>() { + @Override + public SnapshotInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a snapshot. + * Patch a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SnapshotInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + SnapshotPatch body = new SnapshotPatch(); + body.withTags(tags); + return service.update(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).toBlocking().last().body(); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName), serviceCallback); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).toBlocking().single().body(); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName), serviceCallback); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, snapshotName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a snapshot. + * Delete snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param snapshotName The name of the mount target + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (snapshotName == null) { + throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, snapshotName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeImpl.java new file mode 100644 index 000000000000..b1fab458bc3c --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeImpl.java @@ -0,0 +1,303 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.Volume; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePatch; +import com.microsoft.azure.management.netapp.v2019_10_01.ServiceLevel; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePropertiesExportPolicy; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePropertiesDataProtection; +import java.util.Map; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePatchPropertiesExportPolicy; +import rx.functions.Func1; + +class VolumeImpl extends CreatableUpdatableImpl implements Volume, Volume.Definition, Volume.Update { + private final NetAppManager manager; + private String resourceGroupName; + private String accountName; + private String poolName; + private String volumeName; + private VolumePatch updateParameter; + + VolumeImpl(String name, NetAppManager manager) { + super(name, new VolumeInner()); + this.manager = manager; + // Set resource name + this.volumeName = name; + // + this.updateParameter = new VolumePatch(); + } + + VolumeImpl(VolumeInner inner, NetAppManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.volumeName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "netAppAccounts"); + this.poolName = IdParsingUtils.getValueFromIdByName(inner.id(), "capacityPools"); + this.volumeName = IdParsingUtils.getValueFromIdByName(inner.id(), "volumes"); + // + this.updateParameter = new VolumePatch(); + } + + @Override + public NetAppManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VolumesInner client = this.manager().inner().volumes(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.poolName, this.volumeName, this.inner()) + .map(new Func1() { + @Override + public VolumeInner call(VolumeInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VolumesInner client = this.manager().inner().volumes(); + return client.updateAsync(this.resourceGroupName, this.accountName, this.poolName, this.volumeName, this.updateParameter) + .map(new Func1() { + @Override + public VolumeInner call(VolumeInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VolumesInner client = this.manager().inner().volumes(); + return client.getAsync(this.resourceGroupName, this.accountName, this.poolName, this.volumeName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new VolumePatch(); + } + + @Override + public String baremetalTenantId() { + return this.inner().baremetalTenantId(); + } + + @Override + public String creationToken() { + return this.inner().creationToken(); + } + + @Override + public VolumePropertiesDataProtection dataProtection() { + return this.inner().dataProtection(); + } + + @Override + public VolumePropertiesExportPolicy exportPolicy() { + return this.inner().exportPolicy(); + } + + @Override + public String fileSystemId() { + return this.inner().fileSystemId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isRestoring() { + return this.inner().isRestoring(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Object mountTargets() { + return this.inner().mountTargets(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List protocolTypes() { + return this.inner().protocolTypes(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ServiceLevel serviceLevel() { + return this.inner().serviceLevel(); + } + + @Override + public String snapshotId() { + return this.inner().snapshotId(); + } + + @Override + public String subnetId() { + return this.inner().subnetId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public long usageThreshold() { + return this.inner().usageThreshold(); + } + + @Override + public String volumeType() { + return this.inner().volumeType(); + } + + @Override + public VolumeImpl withExistingCapacityPool(String resourceGroupName, String accountName, String poolName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.poolName = poolName; + return this; + } + + @Override + public VolumeImpl withCreationToken(String creationToken) { + this.inner().withCreationToken(creationToken); + return this; + } + + @Override + public VolumeImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public VolumeImpl withSubnetId(String subnetId) { + this.inner().withSubnetId(subnetId); + return this; + } + + @Override + public VolumeImpl withUsageThreshold(long usageThreshold) { + this.inner().withUsageThreshold(usageThreshold); + return this; + } + + @Override + public VolumeImpl withDataProtection(VolumePropertiesDataProtection dataProtection) { + this.inner().withDataProtection(dataProtection); + return this; + } + + @Override + public VolumeImpl withExportPolicy(VolumePropertiesExportPolicy exportPolicy) { + this.inner().withExportPolicy(exportPolicy); + return this; + } + + @Override + public VolumeImpl withIsRestoring(Boolean isRestoring) { + this.inner().withIsRestoring(isRestoring); + return this; + } + + @Override + public VolumeImpl withMountTargets(Object mountTargets) { + this.inner().withMountTargets(mountTargets); + return this; + } + + @Override + public VolumeImpl withProtocolTypes(List protocolTypes) { + this.inner().withProtocolTypes(protocolTypes); + return this; + } + + @Override + public VolumeImpl withSnapshotId(String snapshotId) { + this.inner().withSnapshotId(snapshotId); + return this; + } + + @Override + public VolumeImpl withVolumeType(String volumeType) { + this.inner().withVolumeType(volumeType); + return this; + } + + @Override + public VolumeImpl withExportPolicy(VolumePatchPropertiesExportPolicy exportPolicy) { + this.updateParameter.withExportPolicy(exportPolicy); + return this; + } + + @Override + public VolumeImpl withUsageThreshold(Long usageThreshold) { + this.updateParameter.withUsageThreshold(usageThreshold); + return this; + } + + @Override + public VolumeImpl withServiceLevel(ServiceLevel serviceLevel) { + if (isInCreateMode()) { + this.inner().withServiceLevel(serviceLevel); + } else { + this.updateParameter.withServiceLevel(serviceLevel); + } + return this; + } + + @Override + public VolumeImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeInner.java new file mode 100644 index 000000000000..06fdd30099e6 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumeInner.java @@ -0,0 +1,370 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.management.netapp.v2019_10_01.ServiceLevel; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePropertiesExportPolicy; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePropertiesDataProtection; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Volume resource. + */ +@JsonFlatten +public class VolumeInner extends Resource { + /** + * FileSystem ID. + * Unique FileSystem Identifier. + */ + @JsonProperty(value = "properties.fileSystemId", access = JsonProperty.Access.WRITE_ONLY) + private String fileSystemId; + + /** + * Creation Token or File Path. + * A unique file path for the volume. Used when creating mount targets. + */ + @JsonProperty(value = "properties.creationToken", required = true) + private String creationToken; + + /** + * serviceLevel. + * The service level of the file system. Possible values include: + * 'Standard', 'Premium', 'Ultra'. + */ + @JsonProperty(value = "properties.serviceLevel") + private ServiceLevel serviceLevel; + + /** + * usageThreshold. + * Maximum storage quota allowed for a file system in bytes. This is a soft + * quota used for alerting only. Minimum size is 100 GiB. Upper limit is + * 100TiB. Specified in bytes. + */ + @JsonProperty(value = "properties.usageThreshold", required = true) + private long usageThreshold; + + /** + * exportPolicy. + * Set of export policy rules. + */ + @JsonProperty(value = "properties.exportPolicy") + private VolumePropertiesExportPolicy exportPolicy; + + /** + * protocolTypes. + * Set of protocol types. + */ + @JsonProperty(value = "properties.protocolTypes") + private List protocolTypes; + + /** + * Azure lifecycle management. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Snapshot ID. + * UUID v4 or resource identifier used to identify the Snapshot. + */ + @JsonProperty(value = "properties.snapshotId") + private String snapshotId; + + /** + * Baremetal Tenant ID. + * Unique Baremetal Tenant Identifier. + */ + @JsonProperty(value = "properties.baremetalTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String baremetalTenantId; + + /** + * The Azure Resource URI for a delegated subnet. Must have the delegation + * Microsoft.NetApp/volumes. + */ + @JsonProperty(value = "properties.subnetId", required = true) + private String subnetId; + + /** + * mountTargets. + * List of mount targets. + */ + @JsonProperty(value = "properties.mountTargets") + private Object mountTargets; + + /** + * What type of volume is this. + */ + @JsonProperty(value = "properties.volumeType") + private String volumeType; + + /** + * DataProtection. + * DataProtection type volumes include an object containing details of the + * replication. + */ + @JsonProperty(value = "properties.dataProtection") + private VolumePropertiesDataProtection dataProtection; + + /** + * Restoring. + */ + @JsonProperty(value = "properties.isRestoring") + private Boolean isRestoring; + + /** + * Get unique FileSystem Identifier. + * + * @return the fileSystemId value + */ + public String fileSystemId() { + return this.fileSystemId; + } + + /** + * Get a unique file path for the volume. Used when creating mount targets. + * + * @return the creationToken value + */ + public String creationToken() { + return this.creationToken; + } + + /** + * Set a unique file path for the volume. Used when creating mount targets. + * + * @param creationToken the creationToken value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withCreationToken(String creationToken) { + this.creationToken = creationToken; + return this; + } + + /** + * Get the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @return the serviceLevel value + */ + public ServiceLevel serviceLevel() { + return this.serviceLevel; + } + + /** + * Set the service level of the file system. Possible values include: 'Standard', 'Premium', 'Ultra'. + * + * @param serviceLevel the serviceLevel value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withServiceLevel(ServiceLevel serviceLevel) { + this.serviceLevel = serviceLevel; + return this; + } + + /** + * Get maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. + * + * @return the usageThreshold value + */ + public long usageThreshold() { + return this.usageThreshold; + } + + /** + * Set maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. + * + * @param usageThreshold the usageThreshold value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withUsageThreshold(long usageThreshold) { + this.usageThreshold = usageThreshold; + return this; + } + + /** + * Get set of export policy rules. + * + * @return the exportPolicy value + */ + public VolumePropertiesExportPolicy exportPolicy() { + return this.exportPolicy; + } + + /** + * Set set of export policy rules. + * + * @param exportPolicy the exportPolicy value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withExportPolicy(VolumePropertiesExportPolicy exportPolicy) { + this.exportPolicy = exportPolicy; + return this; + } + + /** + * Get set of protocol types. + * + * @return the protocolTypes value + */ + public List protocolTypes() { + return this.protocolTypes; + } + + /** + * Set set of protocol types. + * + * @param protocolTypes the protocolTypes value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withProtocolTypes(List protocolTypes) { + this.protocolTypes = protocolTypes; + return this; + } + + /** + * Get azure lifecycle management. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get uUID v4 or resource identifier used to identify the Snapshot. + * + * @return the snapshotId value + */ + public String snapshotId() { + return this.snapshotId; + } + + /** + * Set uUID v4 or resource identifier used to identify the Snapshot. + * + * @param snapshotId the snapshotId value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + return this; + } + + /** + * Get unique Baremetal Tenant Identifier. + * + * @return the baremetalTenantId value + */ + public String baremetalTenantId() { + return this.baremetalTenantId; + } + + /** + * Get the Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + * + * @param subnetId the subnetId value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get list of mount targets. + * + * @return the mountTargets value + */ + public Object mountTargets() { + return this.mountTargets; + } + + /** + * Set list of mount targets. + * + * @param mountTargets the mountTargets value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withMountTargets(Object mountTargets) { + this.mountTargets = mountTargets; + return this; + } + + /** + * Get what type of volume is this. + * + * @return the volumeType value + */ + public String volumeType() { + return this.volumeType; + } + + /** + * Set what type of volume is this. + * + * @param volumeType the volumeType value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withVolumeType(String volumeType) { + this.volumeType = volumeType; + return this; + } + + /** + * Get dataProtection type volumes include an object containing details of the replication. + * + * @return the dataProtection value + */ + public VolumePropertiesDataProtection dataProtection() { + return this.dataProtection; + } + + /** + * Set dataProtection type volumes include an object containing details of the replication. + * + * @param dataProtection the dataProtection value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withDataProtection(VolumePropertiesDataProtection dataProtection) { + this.dataProtection = dataProtection; + return this; + } + + /** + * Get restoring. + * + * @return the isRestoring value + */ + public Boolean isRestoring() { + return this.isRestoring; + } + + /** + * Set restoring. + * + * @param isRestoring the isRestoring value to set + * @return the VolumeInner object itself. + */ + public VolumeInner withIsRestoring(Boolean isRestoring) { + this.isRestoring = isRestoring; + return this; + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesImpl.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesImpl.java new file mode 100644 index 000000000000..6af18eaa7fd5 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesImpl.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.netapp.v2019_10_01.Volumes; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.netapp.v2019_10_01.Volume; +import com.microsoft.azure.management.netapp.v2019_10_01.ReplicationStatus; + +class VolumesImpl extends WrapperImpl implements Volumes { + private final NetAppManager manager; + + VolumesImpl(NetAppManager manager) { + super(manager.inner().volumes()); + this.manager = manager; + } + + public NetAppManager manager() { + return this.manager; + } + + @Override + public VolumeImpl define(String name) { + return wrapModel(name); + } + + private VolumeImpl wrapModel(VolumeInner inner) { + return new VolumeImpl(inner, manager()); + } + + private VolumeImpl wrapModel(String name) { + return new VolumeImpl(name, this.manager()); + } + + @Override + public Completable breakReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.breakReplicationAsync(resourceGroupName, accountName, poolName, volumeName).toCompletable(); + } + + @Override + public Completable resyncReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.resyncReplicationAsync(resourceGroupName, accountName, poolName, volumeName).toCompletable(); + } + + @Override + public Completable deleteReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.deleteReplicationAsync(resourceGroupName, accountName, poolName, volumeName).toCompletable(); + } + + @Override + public Completable authorizeReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.authorizeReplicationAsync(resourceGroupName, accountName, poolName, volumeName).toCompletable(); + } + + @Override + public Observable listAsync(String resourceGroupName, String accountName, String poolName) { + VolumesInner client = this.inner(); + return client.listAsync(resourceGroupName, accountName, poolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Volume call(VolumeInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, poolName, volumeName) + .flatMap(new Func1>() { + @Override + public Observable call(VolumeInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Volume)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, poolName, volumeName).toCompletable(); + } + + @Override + public Observable replicationStatusMethodAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + VolumesInner client = this.inner(); + return client.replicationStatusMethodAsync(resourceGroupName, accountName, poolName, volumeName) + .map(new Func1() { + @Override + public ReplicationStatus call(ReplicationStatusInner inner) { + return new ReplicationStatusImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesInner.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesInner.java new file mode 100644 index 000000000000..5c213866dc84 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/VolumesInner.java @@ -0,0 +1,1452 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.netapp.v2019_10_01.AuthorizeRequest; +import com.microsoft.azure.management.netapp.v2019_10_01.VolumePatch; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Volumes. + */ +public class VolumesInner { + /** The Retrofit service to perform REST calls. */ + private VolumesService service; + /** The service client containing this operation class. */ + private AzureNetAppFilesManagementClientImpl client; + + /** + * Initializes an instance of VolumesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VolumesInner(Retrofit retrofit, AzureNetAppFilesManagementClientImpl client) { + this.service = retrofit.create(VolumesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Volumes to be + * used by Retrofit to perform actually REST calls. + */ + interface VolumesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Body VolumeInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Body VolumeInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Body VolumePatch body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes breakReplication" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication") + Observable> breakReplication(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes replicationStatusMethod" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus") + Observable> replicationStatusMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes resyncReplication" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication") + Observable> resyncReplication(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes deleteReplication" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication") + Observable> deleteReplication(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.netapp.v2019_10_01.Volumes authorizeReplication" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication") + Observable> authorizeReplication(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("poolName") String poolName, @Path("volumeName") String volumeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizeRequest body, @Header("User-Agent") String userAgent); + + } + + /** + * Describe all volumes. + * List all volumes within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<VolumeInner> object if successful. + */ + public List list(String resourceGroupName, String accountName, String poolName) { + return listWithServiceResponseAsync(resourceGroupName, accountName, poolName).toBlocking().single().body(); + } + + /** + * Describe all volumes. + * List all volumes within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String accountName, String poolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, accountName, poolName), serviceCallback); + } + + /** + * Describe all volumes. + * List all volumes within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<VolumeInner> object + */ + public Observable> listAsync(String resourceGroupName, String accountName, String poolName) { + return listWithServiceResponseAsync(resourceGroupName, accountName, poolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Describe all volumes. + * List all volumes within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<VolumeInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, accountName, poolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Describe a volume. + * Get the details of the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VolumeInner object if successful. + */ + public VolumeInner get(String resourceGroupName, String accountName, String poolName, String volumeName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Describe a volume. + * Get the details of the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Describe a volume. + * Get the details of the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VolumeInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, VolumeInner>() { + @Override + public VolumeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Describe a volume. + * Get the details of the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VolumeInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VolumeInner object if successful. + */ + public VolumeInner createOrUpdate(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body).toBlocking().last().body(); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body), serviceCallback); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body).map(new Func1, VolumeInner>() { + @Override + public VolumeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VolumeInner object if successful. + */ + public VolumeInner beginCreateOrUpdate(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body).toBlocking().single().body(); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body), serviceCallback); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VolumeInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body).map(new Func1, VolumeInner>() { + @Override + public VolumeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update a volume. + * Create or update the specified volume within the capacity pool. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VolumeInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumeInner body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a volume. + * Patch the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VolumeInner object if successful. + */ + public VolumeInner update(String resourceGroupName, String accountName, String poolName, String volumeName, VolumePatch body) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body).toBlocking().single().body(); + } + + /** + * Update a volume. + * Patch the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumePatch body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body), serviceCallback); + } + + /** + * Update a volume. + * Patch the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VolumeInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumePatch body) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, body).map(new Func1, VolumeInner>() { + @Override + public VolumeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a volume. + * Patch the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param body Volume object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VolumeInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, VolumePatch body) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.update(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName, String poolName, String volumeName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().last().body(); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String accountName, String poolName, String volumeName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a volume. + * Delete the specified volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Break volume replication. + * Break the replication connection on the destination volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void breakReplication(String resourceGroupName, String accountName, String poolName, String volumeName) { + breakReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Break volume replication. + * Break the replication connection on the destination volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture breakReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(breakReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Break volume replication. + * Break the replication connection on the destination volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable breakReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return breakReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Break volume replication. + * Break the replication connection on the destination volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> breakReplicationWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.breakReplication(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = breakReplicationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse breakReplicationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get volume replication status. + * Get the status of the replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationStatusInner object if successful. + */ + public ReplicationStatusInner replicationStatusMethod(String resourceGroupName, String accountName, String poolName, String volumeName) { + return replicationStatusMethodWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Get volume replication status. + * Get the status of the replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture replicationStatusMethodAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replicationStatusMethodWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Get volume replication status. + * Get the status of the replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationStatusInner object + */ + public Observable replicationStatusMethodAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return replicationStatusMethodWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, ReplicationStatusInner>() { + @Override + public ReplicationStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get volume replication status. + * Get the status of the replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationStatusInner object + */ + public Observable> replicationStatusMethodWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.replicationStatusMethod(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = replicationStatusMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse replicationStatusMethodDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Resync volume replication. + * Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from source to destination. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void resyncReplication(String resourceGroupName, String accountName, String poolName, String volumeName) { + resyncReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Resync volume replication. + * Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from source to destination. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture resyncReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resyncReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Resync volume replication. + * Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from source to destination. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable resyncReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return resyncReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resync volume replication. + * Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from source to destination. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> resyncReplicationWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.resyncReplication(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = resyncReplicationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse resyncReplicationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete volume replication. + * Delete the replication connection on the destination volume, and send release to the source replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteReplication(String resourceGroupName, String accountName, String poolName, String volumeName) { + deleteReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Delete volume replication. + * Delete the replication connection on the destination volume, and send release to the source replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Delete volume replication. + * Delete the replication connection on the destination volume, and send release to the source replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return deleteReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete volume replication. + * Delete the replication connection on the destination volume, and send release to the source replication. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteReplicationWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteReplication(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteReplicationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteReplicationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void authorizeReplication(String resourceGroupName, String accountName, String poolName, String volumeName) { + authorizeReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).toBlocking().single().body(); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture authorizeReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(authorizeReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName), serviceCallback); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable authorizeReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + return authorizeReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> authorizeReplicationWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String remoteVolumeResourceId = null; + AuthorizeRequest body = new AuthorizeRequest(); + body.withRemoteVolumeResourceId(null); + return service.authorizeReplication(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = authorizeReplicationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param remoteVolumeResourceId Resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void authorizeReplication(String resourceGroupName, String accountName, String poolName, String volumeName, String remoteVolumeResourceId) { + authorizeReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, remoteVolumeResourceId).toBlocking().single().body(); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param remoteVolumeResourceId Resource id + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture authorizeReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String remoteVolumeResourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(authorizeReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, remoteVolumeResourceId), serviceCallback); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param remoteVolumeResourceId Resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable authorizeReplicationAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String remoteVolumeResourceId) { + return authorizeReplicationWithServiceResponseAsync(resourceGroupName, accountName, poolName, volumeName, remoteVolumeResourceId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Authorize source volume replication. + * Authorize the replication connection on the source volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account + * @param poolName The name of the capacity pool + * @param volumeName The name of the volume + * @param remoteVolumeResourceId Resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> authorizeReplicationWithServiceResponseAsync(String resourceGroupName, String accountName, String poolName, String volumeName, String remoteVolumeResourceId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (poolName == null) { + throw new IllegalArgumentException("Parameter poolName is required and cannot be null."); + } + if (volumeName == null) { + throw new IllegalArgumentException("Parameter volumeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + AuthorizeRequest body = new AuthorizeRequest(); + body.withRemoteVolumeResourceId(remoteVolumeResourceId); + return service.authorizeReplication(this.client.subscriptionId(), resourceGroupName, accountName, poolName, volumeName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = authorizeReplicationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse authorizeReplicationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/package-info.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/package-info.java new file mode 100644 index 000000000000..be084301514b --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for AzureNetAppFilesManagementClient. + * Microsoft NetApp Azure Resource Provider specification. + */ +package com.microsoft.azure.management.netapp.v2019_10_01.implementation; diff --git a/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/package-info.java b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/package-info.java new file mode 100644 index 000000000000..ce15ec7708a2 --- /dev/null +++ b/sdk/netapp/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/netapp/v2019_10_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for AzureNetAppFilesManagementClient. + * Microsoft NetApp Azure Resource Provider specification. + */ +package com.microsoft.azure.management.netapp.v2019_10_01; diff --git a/sdk/netapp/pom.mgmt.xml b/sdk/netapp/pom.mgmt.xml index 7004bf4f6e34..133c121ef4e7 100644 --- a/sdk/netapp/pom.mgmt.xml +++ b/sdk/netapp/pom.mgmt.xml @@ -14,5 +14,6 @@ mgmt-v2019_06_01 mgmt-v2019_07_01 mgmt-v2019_08_01 + mgmt-v2019_10_01 diff --git a/sdk/policy/mgmt-v2019_09_01/pom.xml b/sdk/policy/mgmt-v2019_09_01/pom.xml new file mode 100644 index 000000000000..4ca85217ce90 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.policy.v2019_09_01 + + com.microsoft.azure + azure-arm-parent + 1.2.0 + ../../../pom.management.xml + + azure-mgmt-policy + 1.0.0-beta + jar + Microsoft Azure SDK for Authorization Management + This package contains Microsoft Authorization Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/EnforcementMode.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/EnforcementMode.java new file mode 100644 index 000000000000..1c07ab96d775 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/EnforcementMode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for EnforcementMode. + */ +public final class EnforcementMode extends ExpandableStringEnum { + /** Static value Default for EnforcementMode. */ + public static final EnforcementMode DEFAULT = fromString("Default"); + + /** Static value DoNotEnforce for EnforcementMode. */ + public static final EnforcementMode DO_NOT_ENFORCE = fromString("DoNotEnforce"); + + /** + * Creates or finds a EnforcementMode from its string representation. + * @param name a name to look for + * @return the corresponding EnforcementMode + */ + @JsonCreator + public static EnforcementMode fromString(String name) { + return fromString(name, EnforcementMode.class); + } + + /** + * @return known EnforcementMode values + */ + public static Collection values() { + return values(EnforcementMode.class); + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorAdditionalInfo.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..10b18829deb2 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorAdditionalInfo.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource management error additional info. + */ +public class ErrorAdditionalInfo { + /** + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the additional info type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the additional info. + * + * @return the info value + */ + public Object info() { + return this.info; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorResponse.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorResponse.java new file mode 100644 index 000000000000..81e528b351da --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ErrorResponse.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource management error response. + */ +public class ErrorResponse { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The error target. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * The error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * The error additional info. + */ + @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private List additionalInfo; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the error target. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get the error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Get the error additional info. + * + * @return the additionalInfo value + */ + public List additionalInfo() { + return this.additionalInfo; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/Identity.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/Identity.java new file mode 100644 index 000000000000..1e0984dc94c7 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/Identity.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of the resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of the resource identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'SystemAssigned', 'None'. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principal ID of the resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of the resource identity. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValue.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValue.java new file mode 100644 index 000000000000..67a78b43fb5b --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValue.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ParameterDefinitionsValue model. + */ +public class ParameterDefinitionsValue { + /** + * The data type of the parameter. Possible values include: 'String', + * 'Array', 'Object', 'Boolean', 'Integer', 'Float', 'DateTime'. + */ + @JsonProperty(value = "type") + private ParameterType type; + + /** + * The allowed values for the parameter. + */ + @JsonProperty(value = "allowedValues") + private List allowedValues; + + /** + * The default value for the parameter if no value is provided. + */ + @JsonProperty(value = "defaultValue") + private Object defaultValue; + + /** + * General metadata for the parameter. + */ + @JsonProperty(value = "metadata") + private ParameterDefinitionsValueMetadata metadata; + + /** + * Get the data type of the parameter. Possible values include: 'String', 'Array', 'Object', 'Boolean', 'Integer', 'Float', 'DateTime'. + * + * @return the type value + */ + public ParameterType type() { + return this.type; + } + + /** + * Set the data type of the parameter. Possible values include: 'String', 'Array', 'Object', 'Boolean', 'Integer', 'Float', 'DateTime'. + * + * @param type the type value to set + * @return the ParameterDefinitionsValue object itself. + */ + public ParameterDefinitionsValue withType(ParameterType type) { + this.type = type; + return this; + } + + /** + * Get the allowed values for the parameter. + * + * @return the allowedValues value + */ + public List allowedValues() { + return this.allowedValues; + } + + /** + * Set the allowed values for the parameter. + * + * @param allowedValues the allowedValues value to set + * @return the ParameterDefinitionsValue object itself. + */ + public ParameterDefinitionsValue withAllowedValues(List allowedValues) { + this.allowedValues = allowedValues; + return this; + } + + /** + * Get the default value for the parameter if no value is provided. + * + * @return the defaultValue value + */ + public Object defaultValue() { + return this.defaultValue; + } + + /** + * Set the default value for the parameter if no value is provided. + * + * @param defaultValue the defaultValue value to set + * @return the ParameterDefinitionsValue object itself. + */ + public ParameterDefinitionsValue withDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get general metadata for the parameter. + * + * @return the metadata value + */ + public ParameterDefinitionsValueMetadata metadata() { + return this.metadata; + } + + /** + * Set general metadata for the parameter. + * + * @param metadata the metadata value to set + * @return the ParameterDefinitionsValue object itself. + */ + public ParameterDefinitionsValue withMetadata(ParameterDefinitionsValueMetadata metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValueMetadata.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValueMetadata.java new file mode 100644 index 000000000000..bf43e1a31186 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterDefinitionsValueMetadata.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * General metadata for the parameter. + */ +public class ParameterDefinitionsValueMetadata { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The display name for the parameter. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The description of the parameter. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ParameterDefinitionsValueMetadata object itself. + */ + public ParameterDefinitionsValueMetadata withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the display name for the parameter. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name for the parameter. + * + * @param displayName the displayName value to set + * @return the ParameterDefinitionsValueMetadata object itself. + */ + public ParameterDefinitionsValueMetadata withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description of the parameter. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the parameter. + * + * @param description the description value to set + * @return the ParameterDefinitionsValueMetadata object itself. + */ + public ParameterDefinitionsValueMetadata withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterType.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterType.java new file mode 100644 index 000000000000..6f3c9dda9e83 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterType.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ParameterType. + */ +public final class ParameterType extends ExpandableStringEnum { + /** Static value String for ParameterType. */ + public static final ParameterType STRING = fromString("String"); + + /** Static value Array for ParameterType. */ + public static final ParameterType ARRAY = fromString("Array"); + + /** Static value Object for ParameterType. */ + public static final ParameterType OBJECT = fromString("Object"); + + /** Static value Boolean for ParameterType. */ + public static final ParameterType BOOLEAN = fromString("Boolean"); + + /** Static value Integer for ParameterType. */ + public static final ParameterType INTEGER = fromString("Integer"); + + /** Static value Float for ParameterType. */ + public static final ParameterType FLOAT = fromString("Float"); + + /** Static value DateTime for ParameterType. */ + public static final ParameterType DATE_TIME = fromString("DateTime"); + + /** + * Creates or finds a ParameterType from its string representation. + * @param name a name to look for + * @return the corresponding ParameterType + */ + @JsonCreator + public static ParameterType fromString(String name) { + return fromString(name, ParameterType.class); + } + + /** + * @return known ParameterType values + */ + public static Collection values() { + return values(ParameterType.class); + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterValuesValue.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterValuesValue.java new file mode 100644 index 000000000000..65d639c31961 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ParameterValuesValue.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ParameterValuesValue model. + */ +public class ParameterValuesValue { + /** + * The value of the parameter. + */ + @JsonProperty(value = "value") + private Object value; + + /** + * Get the value of the parameter. + * + * @return the value value + */ + public Object value() { + return this.value; + } + + /** + * Set the value of the parameter. + * + * @param value the value value to set + * @return the ParameterValuesValue object itself. + */ + public ParameterValuesValue withValue(Object value) { + this.value = value; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignment.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignment.java new file mode 100644 index 000000000000..09c58800bd09 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignment.java @@ -0,0 +1,408 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyAssignmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing PolicyAssignment. + */ +public interface PolicyAssignment extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enforcementMode value. + */ + EnforcementMode enforcementMode(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notScopes value. + */ + List notScopes(); + + /** + * @return the parameters value. + */ + Map parameters(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the scopeProperty value. + */ + String scopeProperty(); + + /** + * @return the sku value. + */ + PolicySku sku(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicyAssignment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyAssignment definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the policyassignment definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @return the next definition stage + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the policyassignment definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policyassignment definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policyassignment definition allowing to specify EnforcementMode. + */ + interface WithEnforcementMode { + /** + * Specifies enforcementMode. + * @param enforcementMode The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce' + * @return the next definition stage + */ + WithCreate withEnforcementMode(EnforcementMode enforcementMode); + } + + /** + * The stage of the policyassignment definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The managed identity associated with the policy assignment + * @return the next definition stage + */ + WithCreate withIdentity(Identity identity); + } + + /** + * The stage of the policyassignment definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the policy assignment. Only required when utilizing managed identity + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the policyassignment definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policyassignment definition allowing to specify NotScopes. + */ + interface WithNotScopes { + /** + * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next definition stage + */ + WithCreate withNotScopes(List notScopes); + } + + /** + * The stage of the policyassignment definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameter values for the assigned policy rule. The keys are the parameter names + * @return the next definition stage + */ + WithCreate withParameters(Map parameters); + } + + /** + * The stage of the policyassignment definition allowing to specify PolicyDefinitionId. + */ + interface WithPolicyDefinitionId { + /** + * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next definition stage + */ + WithCreate withPolicyDefinitionId(String policyDefinitionId); + } + + /** + * The stage of the policyassignment definition allowing to specify ScopeProperty. + */ + interface WithScopeProperty { + /** + * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next definition stage + */ + WithCreate withScopeProperty(String scopeProperty); + } + + /** + * The stage of the policyassignment definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next definition stage + */ + WithCreate withSku(PolicySku sku); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithEnforcementMode, DefinitionStages.WithIdentity, DefinitionStages.WithLocation, DefinitionStages.WithMetadata, DefinitionStages.WithNotScopes, DefinitionStages.WithParameters, DefinitionStages.WithPolicyDefinitionId, DefinitionStages.WithScopeProperty, DefinitionStages.WithSku { + } + } + /** + * The template for a PolicyAssignment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithEnforcementMode, UpdateStages.WithIdentity, UpdateStages.WithLocation, UpdateStages.WithMetadata, UpdateStages.WithNotScopes, UpdateStages.WithParameters, UpdateStages.WithPolicyDefinitionId, UpdateStages.WithScopeProperty, UpdateStages.WithSku { + } + + /** + * Grouping of PolicyAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the policyassignment update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policyassignment update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policyassignment update allowing to specify EnforcementMode. + */ + interface WithEnforcementMode { + /** + * Specifies enforcementMode. + * @param enforcementMode The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce' + * @return the next update stage + */ + Update withEnforcementMode(EnforcementMode enforcementMode); + } + + /** + * The stage of the policyassignment update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The managed identity associated with the policy assignment + * @return the next update stage + */ + Update withIdentity(Identity identity); + } + + /** + * The stage of the policyassignment update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the policy assignment. Only required when utilizing managed identity + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the policyassignment update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policyassignment update allowing to specify NotScopes. + */ + interface WithNotScopes { + /** + * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next update stage + */ + Update withNotScopes(List notScopes); + } + + /** + * The stage of the policyassignment update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameter values for the assigned policy rule. The keys are the parameter names + * @return the next update stage + */ + Update withParameters(Map parameters); + } + + /** + * The stage of the policyassignment update allowing to specify PolicyDefinitionId. + */ + interface WithPolicyDefinitionId { + /** + * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next update stage + */ + Update withPolicyDefinitionId(String policyDefinitionId); + } + + /** + * The stage of the policyassignment update allowing to specify ScopeProperty. + */ + interface WithScopeProperty { + /** + * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next update stage + */ + Update withScopeProperty(String scopeProperty); + } + + /** + * The stage of the policyassignment update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next update stage + */ + Update withSku(PolicySku sku); + } + + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignments.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignments.java new file mode 100644 index 000000000000..a21940c8ce93 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyAssignments.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyAssignmentInner; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicyAssignments. + */ +public interface PolicyAssignments extends SupportsCreating, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String scope, String policyAssignmentName); + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String scope, String policyAssignmentName); + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName); + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByIdAsync(String policyAssignmentId); + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters); + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String policyAssignmentId); + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinition.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinition.java new file mode 100644 index 000000000000..23bad8ca2105 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinition.java @@ -0,0 +1,279 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyManager; +import java.util.Map; + +/** + * Type representing PolicyDefinition. + */ +public interface PolicyDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the mode value. + */ + String mode(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Map parameters(); + + /** + * @return the policyRule value. + */ + Object policyRule(); + + /** + * @return the policyType value. + */ + PolicyType policyType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicyDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyDefinition definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the policydefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policydefinition definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policydefinition definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policydefinition definition allowing to specify Mode. + */ + interface WithMode { + /** + * Specifies mode. + * @param mode The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data + * @return the next definition stage + */ + WithCreate withMode(String mode); + } + + /** + * The stage of the policydefinition definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameter definitions for parameters used in the policy rule. The keys are the parameter names + * @return the next definition stage + */ + WithCreate withParameters(Map parameters); + } + + /** + * The stage of the policydefinition definition allowing to specify PolicyRule. + */ + interface WithPolicyRule { + /** + * Specifies policyRule. + * @param policyRule The policy rule + * @return the next definition stage + */ + WithCreate withPolicyRule(Object policyRule); + } + + /** + * The stage of the policydefinition definition allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static' + * @return the next definition stage + */ + WithCreate withPolicyType(PolicyType policyType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadata, DefinitionStages.WithMode, DefinitionStages.WithParameters, DefinitionStages.WithPolicyRule, DefinitionStages.WithPolicyType { + } + } + /** + * The template for a PolicyDefinition update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMetadata, UpdateStages.WithMode, UpdateStages.WithParameters, UpdateStages.WithPolicyRule, UpdateStages.WithPolicyType { + } + + /** + * Grouping of PolicyDefinition update stages. + */ + interface UpdateStages { + /** + * The stage of the policydefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policydefinition update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policydefinition update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policydefinition update allowing to specify Mode. + */ + interface WithMode { + /** + * Specifies mode. + * @param mode The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data + * @return the next update stage + */ + Update withMode(String mode); + } + + /** + * The stage of the policydefinition update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameter definitions for parameters used in the policy rule. The keys are the parameter names + * @return the next update stage + */ + Update withParameters(Map parameters); + } + + /** + * The stage of the policydefinition update allowing to specify PolicyRule. + */ + interface WithPolicyRule { + /** + * Specifies policyRule. + * @param policyRule The policy rule + * @return the next update stage + */ + Update withPolicyRule(Object policyRule); + } + + /** + * The stage of the policydefinition update allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static' + * @return the next update stage + */ + Update withPolicyType(PolicyType policyType); + } + + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionGroup.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionGroup.java new file mode 100644 index 000000000000..7fce7eee33d4 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionGroup.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy definition group. + */ +public class PolicyDefinitionGroup { + /** + * The name of the group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The group's display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The group's category. + */ + @JsonProperty(value = "category") + private String category; + + /** + * The group's description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * A resource ID of a resource that contains additional metadata about the + * group. + */ + @JsonProperty(value = "additionalMetadataId") + private String additionalMetadataId; + + /** + * Get the name of the group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the group. + * + * @param name the name value to set + * @return the PolicyDefinitionGroup object itself. + */ + public PolicyDefinitionGroup withName(String name) { + this.name = name; + return this; + } + + /** + * Get the group's display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the group's display name. + * + * @param displayName the displayName value to set + * @return the PolicyDefinitionGroup object itself. + */ + public PolicyDefinitionGroup withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the group's category. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set the group's category. + * + * @param category the category value to set + * @return the PolicyDefinitionGroup object itself. + */ + public PolicyDefinitionGroup withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the group's description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the group's description. + * + * @param description the description value to set + * @return the PolicyDefinitionGroup object itself. + */ + public PolicyDefinitionGroup withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get a resource ID of a resource that contains additional metadata about the group. + * + * @return the additionalMetadataId value + */ + public String additionalMetadataId() { + return this.additionalMetadataId; + } + + /** + * Set a resource ID of a resource that contains additional metadata about the group. + * + * @param additionalMetadataId the additionalMetadataId value to set + * @return the PolicyDefinitionGroup object itself. + */ + public PolicyDefinitionGroup withAdditionalMetadataId(String additionalMetadataId) { + this.additionalMetadataId = additionalMetadataId; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionReference.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionReference.java new file mode 100644 index 000000000000..baeb8e50f31b --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitionReference.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy definition reference. + */ +public class PolicyDefinitionReference { + /** + * The ID of the policy definition or policy set definition. + */ + @JsonProperty(value = "policyDefinitionId", required = true) + private String policyDefinitionId; + + /** + * The parameter values for the referenced policy rule. The keys are the + * parameter names. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * A unique id (within the policy set definition) for this policy + * definition reference. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /** + * The name of the groups that this policy definition reference belongs to. + */ + @JsonProperty(value = "groupNames") + private List groupNames; + + /** + * Get the ID of the policy definition or policy set definition. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the ID of the policy definition or policy set definition. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the parameter values for the referenced policy rule. The keys are the parameter names. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameter values for the referenced policy rule. The keys are the parameter names. + * + * @param parameters the parameters value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get a unique id (within the policy set definition) for this policy definition reference. + * + * @return the policyDefinitionReferenceId value + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set a unique id (within the policy set definition) for this policy definition reference. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the name of the groups that this policy definition reference belongs to. + * + * @return the groupNames value + */ + public List groupNames() { + return this.groupNames; + } + + /** + * Set the name of the groups that this policy definition reference belongs to. + * + * @param groupNames the groupNames value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withGroupNames(List groupNames) { + this.groupNames = groupNames; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitions.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitions.java new file mode 100644 index 000000000000..e6d6e2294d46 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyDefinitions.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyDefinitionInner; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicyDefinitions. + */ +public interface PolicyDefinitions extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String policyDefinitionName); + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String policyDefinitionName); + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBuiltInAsync(String policyDefinitionName); + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters); + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId); + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId); + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBuiltInAsync(); + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinition.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinition.java new file mode 100644 index 000000000000..d5d976861fc1 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinition.java @@ -0,0 +1,268 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicySetDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicyManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing PolicySetDefinition. + */ +public interface PolicySetDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Map parameters(); + + /** + * @return the policyDefinitionGroups value. + */ + List policyDefinitionGroups(); + + /** + * @return the policyDefinitions value. + */ + List policyDefinitions(); + + /** + * @return the policyType value. + */ + PolicyType policyType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicySetDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPolicyDefinitions, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicySetDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicySetDefinition definition. + */ + interface Blank extends WithPolicyDefinitions { + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyDefinitions. + */ + interface WithPolicyDefinitions { + /** + * Specifies policyDefinitions. + * @param policyDefinitions An array of policy definition references + * @return the next definition stage + */ + WithCreate withPolicyDefinitions(List policyDefinitions); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy set definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policysetdefinition definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next definition stage + */ + WithCreate withParameters(Map parameters); + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyDefinitionGroups. + */ + interface WithPolicyDefinitionGroups { + /** + * Specifies policyDefinitionGroups. + * @param policyDefinitionGroups The metadata describing groups of policy definition references within the policy set definition + * @return the next definition stage + */ + WithCreate withPolicyDefinitionGroups(List policyDefinitionGroups); + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static' + * @return the next definition stage + */ + WithCreate withPolicyType(PolicyType policyType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadata, DefinitionStages.WithParameters, DefinitionStages.WithPolicyDefinitionGroups, DefinitionStages.WithPolicyType { + } + } + /** + * The template for a PolicySetDefinition update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMetadata, UpdateStages.WithParameters, UpdateStages.WithPolicyDefinitionGroups, UpdateStages.WithPolicyType { + } + + /** + * Grouping of PolicySetDefinition update stages. + */ + interface UpdateStages { + /** + * The stage of the policysetdefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy set definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policysetdefinition update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policysetdefinition update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policysetdefinition update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next update stage + */ + Update withParameters(Map parameters); + } + + /** + * The stage of the policysetdefinition update allowing to specify PolicyDefinitionGroups. + */ + interface WithPolicyDefinitionGroups { + /** + * Specifies policyDefinitionGroups. + * @param policyDefinitionGroups The metadata describing groups of policy definition references within the policy set definition + * @return the next update stage + */ + Update withPolicyDefinitionGroups(List policyDefinitionGroups); + } + + /** + * The stage of the policysetdefinition update allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static' + * @return the next update stage + */ + Update withPolicyType(PolicyType policyType); + } + + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinitions.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinitions.java new file mode 100644 index 000000000000..abe55945a3d1 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySetDefinitions.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicySetDefinitionInner; +import com.microsoft.azure.management.policy.v2019_09_01.implementation.PolicySetDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicySetDefinitions. + */ +public interface PolicySetDefinitions extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String policySetDefinitionName); + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String policySetDefinitionName); + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBuiltInAsync(String policySetDefinitionName); + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters); + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId); + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId); + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBuiltInAsync(); + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySku.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySku.java new file mode 100644 index 000000000000..de8713b32068 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicySku.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy sku. This property is optional, obsolete, and will be ignored. + */ +public class PolicySku { + /** + * The name of the policy sku. Possible values are A0 and A1. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The policy sku tier. Possible values are Free and Standard. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * Get the name of the policy sku. Possible values are A0 and A1. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the policy sku. Possible values are A0 and A1. + * + * @param name the name value to set + * @return the PolicySku object itself. + */ + public PolicySku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the policy sku tier. Possible values are Free and Standard. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the policy sku tier. Possible values are Free and Standard. + * + * @param tier the tier value to set + * @return the PolicySku object itself. + */ + public PolicySku withTier(String tier) { + this.tier = tier; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyType.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyType.java new file mode 100644 index 000000000000..4f8c79ae7062 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/PolicyType.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyType. + */ +public final class PolicyType extends ExpandableStringEnum { + /** Static value NotSpecified for PolicyType. */ + public static final PolicyType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value BuiltIn for PolicyType. */ + public static final PolicyType BUILT_IN = fromString("BuiltIn"); + + /** Static value Custom for PolicyType. */ + public static final PolicyType CUSTOM = fromString("Custom"); + + /** Static value Static for PolicyType. */ + public static final PolicyType STATIC = fromString("Static"); + + /** + * Creates or finds a PolicyType from its string representation. + * @param name a name to look for + * @return the corresponding PolicyType + */ + @JsonCreator + public static PolicyType fromString(String name) { + return fromString(name, PolicyType.class); + } + + /** + * @return known PolicyType values + */ + public static Collection values() { + return values(PolicyType.class); + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ResourceIdentityType.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ResourceIdentityType.java new file mode 100644 index 000000000000..a7ebe329f66e --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/ResourceIdentityType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/IdParsingUtils.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..37d0b04b9a48 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PageImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PageImpl.java new file mode 100644 index 000000000000..4edb1f0201ee --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentImpl.java new file mode 100644 index 000000000000..83aad6571d49 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentImpl.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import java.util.Map; +import com.microsoft.azure.management.policy.v2019_09_01.ParameterValuesValue; +import com.microsoft.azure.management.policy.v2019_09_01.EnforcementMode; +import com.microsoft.azure.management.policy.v2019_09_01.PolicySku; +import com.microsoft.azure.management.policy.v2019_09_01.Identity; + +class PolicyAssignmentImpl extends CreatableUpdatableImpl implements PolicyAssignment, PolicyAssignment.Definition, PolicyAssignment.Update { + private String scope; + private String policyAssignmentName; + private final PolicyManager manager; + + PolicyAssignmentImpl(String name, PolicyManager manager) { + super(name, new PolicyAssignmentInner()); + this.manager = manager; + // Set resource name + this.policyAssignmentName = name; + // + } + + PolicyAssignmentImpl(PolicyAssignmentInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policyAssignmentName = inner.name(); + // set resource ancestor and positional variables + this.policyAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "policyAssignments"); + this.scope = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.createAsync(this.scope, this.policyAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.createAsync(this.scope, this.policyAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.getAsync(this.scope, this.policyAssignmentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public EnforcementMode enforcementMode() { + return this.inner().enforcementMode(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List notScopes() { + return this.inner().notScopes(); + } + + @Override + public Map parameters() { + return this.inner().parameters(); + } + + @Override + public String policyDefinitionId() { + return this.inner().policyDefinitionId(); + } + + @Override + public String scopeProperty() { + return this.inner().scopeProperty(); + } + + @Override + public PolicySku sku() { + return this.inner().sku(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyAssignmentImpl withScope(String scope) { + this.scope = scope; + return this; + } + + @Override + public PolicyAssignmentImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyAssignmentImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicyAssignmentImpl withEnforcementMode(EnforcementMode enforcementMode) { + this.inner().withEnforcementMode(enforcementMode); + return this; + } + + @Override + public PolicyAssignmentImpl withIdentity(Identity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public PolicyAssignmentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public PolicyAssignmentImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicyAssignmentImpl withNotScopes(List notScopes) { + this.inner().withNotScopes(notScopes); + return this; + } + + @Override + public PolicyAssignmentImpl withParameters(Map parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicyAssignmentImpl withPolicyDefinitionId(String policyDefinitionId) { + this.inner().withPolicyDefinitionId(policyDefinitionId); + return this; + } + + @Override + public PolicyAssignmentImpl withScopeProperty(String scopeProperty) { + this.inner().withScopeProperty(scopeProperty); + return this; + } + + @Override + public PolicyAssignmentImpl withSku(PolicySku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentInner.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentInner.java new file mode 100644 index 000000000000..ff5d1af15f3d --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentInner.java @@ -0,0 +1,317 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import java.util.List; +import java.util.Map; +import com.microsoft.azure.management.policy.v2019_09_01.ParameterValuesValue; +import com.microsoft.azure.management.policy.v2019_09_01.EnforcementMode; +import com.microsoft.azure.management.policy.v2019_09_01.PolicySku; +import com.microsoft.azure.management.policy.v2019_09_01.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy assignment. + */ +@JsonFlatten +public class PolicyAssignmentInner extends ProxyResource { + /** + * The display name of the policy assignment. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The ID of the policy definition or policy set definition being assigned. + */ + @JsonProperty(value = "properties.policyDefinitionId") + private String policyDefinitionId; + + /** + * The scope for the policy assignment. + */ + @JsonProperty(value = "properties.scope") + private String scopeProperty; + + /** + * The policy's excluded scopes. + */ + @JsonProperty(value = "properties.notScopes") + private List notScopes; + + /** + * The parameter values for the assigned policy rule. The keys are the + * parameter names. + */ + @JsonProperty(value = "properties.parameters") + private Map parameters; + + /** + * This message will be part of response in case of policy violation. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy assignment metadata. Metadata is an open ended object and is + * typically a collection of key value pairs. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The policy assignment enforcement mode. Possible values are Default and + * DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce'. + */ + @JsonProperty(value = "properties.enforcementMode") + private EnforcementMode enforcementMode; + + /** + * The policy sku. This property is optional, obsolete, and will be + * ignored. + */ + @JsonProperty(value = "sku") + private PolicySku sku; + + /** + * The location of the policy assignment. Only required when utilizing + * managed identity. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The managed identity associated with the policy assignment. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the display name of the policy assignment. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy assignment. + * + * @param displayName the displayName value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the ID of the policy definition or policy set definition being assigned. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the ID of the policy definition or policy set definition being assigned. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the scope for the policy assignment. + * + * @return the scopeProperty value + */ + public String scopeProperty() { + return this.scopeProperty; + } + + /** + * Set the scope for the policy assignment. + * + * @param scopeProperty the scopeProperty value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withScopeProperty(String scopeProperty) { + this.scopeProperty = scopeProperty; + return this; + } + + /** + * Get the policy's excluded scopes. + * + * @return the notScopes value + */ + public List notScopes() { + return this.notScopes; + } + + /** + * Set the policy's excluded scopes. + * + * @param notScopes the notScopes value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withNotScopes(List notScopes) { + this.notScopes = notScopes; + return this; + } + + /** + * Get the parameter values for the assigned policy rule. The keys are the parameter names. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameter values for the assigned policy rule. The keys are the parameter names. + * + * @param parameters the parameters value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get this message will be part of response in case of policy violation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set this message will be part of response in case of policy violation. + * + * @param description the description value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs. + * + * @param metadata the metadata value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce'. + * + * @return the enforcementMode value + */ + public EnforcementMode enforcementMode() { + return this.enforcementMode; + } + + /** + * Set the policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce'. + * + * @param enforcementMode the enforcementMode value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withEnforcementMode(EnforcementMode enforcementMode) { + this.enforcementMode = enforcementMode; + return this; + } + + /** + * Get the policy sku. This property is optional, obsolete, and will be ignored. + * + * @return the sku value + */ + public PolicySku sku() { + return this.sku; + } + + /** + * Set the policy sku. This property is optional, obsolete, and will be ignored. + * + * @param sku the sku value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withSku(PolicySku sku) { + this.sku = sku; + return this; + } + + /** + * Get the location of the policy assignment. Only required when utilizing managed identity. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the policy assignment. Only required when utilizing managed identity. + * + * @param location the location value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the managed identity associated with the policy assignment. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the managed identity associated with the policy assignment. + * + * @param identity the identity value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsImpl.java new file mode 100644 index 000000000000..b86c353d89f5 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsImpl.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignment; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicyAssignmentsImpl extends WrapperImpl implements PolicyAssignments { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicyAssignmentsImpl(PolicyManager manager) { + super(manager.inner().policyAssignments()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicyAssignmentInner inner) { + return Observable.just((PolicyAssignment) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicyAssignmentImpl define(String name) { + return wrapModel(name); + } + + private PolicyAssignmentImpl wrapModel(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + + private PolicyAssignmentImpl wrapModel(String name) { + return new PolicyAssignmentImpl(name, this.manager()); + } + + @Override + public Observable deleteAsync(String scope, String policyAssignmentName) { + PolicyAssignmentsInner client = this.inner(); + return client.deleteAsync(scope, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String scope, String policyAssignmentName) { + PolicyAssignmentsInner client = this.inner(); + return client.getAsync(scope, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + PolicyAssignmentsInner client = this.inner(); + return client.listForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByIdAsync(String policyAssignmentId) { + PolicyAssignmentsInner client = this.inner(); + return client.deleteByIdAsync(policyAssignmentId) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + PolicyAssignmentsInner client = this.inner(); + return client.createByIdAsync(policyAssignmentId, parameters) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String policyAssignmentId) { + PolicyAssignmentsInner client = this.inner(); + return client.getByIdAsync(policyAssignmentId) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicyAssignmentsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicyAssignmentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + PolicyAssignmentsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + PolicyAssignmentsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsInner.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsInner.java new file mode 100644 index 000000000000..efad9049cf0b --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyAssignmentsInner.java @@ -0,0 +1,1748 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyAssignments. + */ +public class PolicyAssignmentsInner implements InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private PolicyAssignmentsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicyAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyAssignmentsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicyAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments delete" }) + @HTTP(path = "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments create" }) + @PUT("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + Observable> create(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Body PolicyAssignmentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments get" }) + @GET("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query(value = "$filter", encoded = true) String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments listForResource" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments") + Observable> listForResource(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments deleteById" }) + @HTTP(path = "{policyAssignmentId}", method = "DELETE", hasBody = true) + Observable> deleteById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments createById" }) + @PUT("{policyAssignmentId}") + Observable> createById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Body PolicyAssignmentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments getById" }) + @GET("{policyAssignmentId}") + Observable> getById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner delete(String scope, String policyAssignmentName) { + return deleteWithServiceResponseAsync(scope, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String scope, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(scope, policyAssignmentName), serviceCallback); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable deleteAsync(String scope, String policyAssignmentName) { + return deleteWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> deleteWithServiceResponseAsync(String scope, String policyAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(scope, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner create(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + return createWithServiceResponseAsync(scope, policyAssignmentName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(scope, policyAssignmentName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable createAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + return createWithServiceResponseAsync(scope, policyAssignmentName, parameters).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> createWithServiceResponseAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(scope, policyAssignmentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner get(String scope, String policyAssignmentName) { + return getWithServiceResponseAsync(scope, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String scope, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, policyAssignmentName), serviceCallback); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable getAsync(String scope, String policyAssignmentName) { + return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> getWithServiceResponseAsync(String scope, String policyAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(scope, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains policy assignments. + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + ServiceResponse> * @param resourceGroupName The name of the resource group containing the resource. + ServiceResponse> * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + ServiceResponse> * @param parentResourcePath The parent resource path. Use empty string if there is none. + ServiceResponse> * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + ServiceResponse> * @param resourceName The name of the resource. + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner deleteById(String policyAssignmentId) { + return deleteByIdWithServiceResponseAsync(policyAssignmentId).toBlocking().single().body(); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(policyAssignmentId), serviceCallback); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable deleteByIdAsync(String policyAssignmentId) { + return deleteByIdWithServiceResponseAsync(policyAssignmentId).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> deleteByIdWithServiceResponseAsync(String policyAssignmentId) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner createById(String policyAssignmentId, PolicyAssignmentInner parameters) { + return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(policyAssignmentId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> createByIdWithServiceResponseAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createById(policyAssignmentId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner getById(String policyAssignmentId) { + return getByIdWithServiceResponseAsync(policyAssignmentId).toBlocking().single().body(); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(policyAssignmentId), serviceCallback); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable getByIdAsync(String policyAssignmentId) { + return getByIdWithServiceResponseAsync(policyAssignmentId).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> getByIdWithServiceResponseAsync(String policyAssignmentId) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResourceNext(final String nextPageLink) { + ServiceResponse> response = listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyClientImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyClientImpl.java new file mode 100644 index 000000000000..a5ddfd8e4824 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyClientImpl.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the PolicyClientImpl class. + */ +public class PolicyClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public PolicyClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public PolicyClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public PolicyClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public PolicyClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PolicyAssignmentsInner object to access its operations. + */ + private PolicyAssignmentsInner policyAssignments; + + /** + * Gets the PolicyAssignmentsInner object to access its operations. + * @return the PolicyAssignmentsInner object. + */ + public PolicyAssignmentsInner policyAssignments() { + return this.policyAssignments; + } + + /** + * The PolicyDefinitionsInner object to access its operations. + */ + private PolicyDefinitionsInner policyDefinitions; + + /** + * Gets the PolicyDefinitionsInner object to access its operations. + * @return the PolicyDefinitionsInner object. + */ + public PolicyDefinitionsInner policyDefinitions() { + return this.policyDefinitions; + } + + /** + * The PolicySetDefinitionsInner object to access its operations. + */ + private PolicySetDefinitionsInner policySetDefinitions; + + /** + * Gets the PolicySetDefinitionsInner object to access its operations. + * @return the PolicySetDefinitionsInner object. + */ + public PolicySetDefinitionsInner policySetDefinitions() { + return this.policySetDefinitions; + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param credentials the management credentials for Azure + */ + public PolicyClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public PolicyClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public PolicyClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-09-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.policyAssignments = new PolicyAssignmentsInner(restClient().retrofit(), this); + this.policyDefinitions = new PolicyDefinitionsInner(restClient().retrofit(), this); + this.policySetDefinitions = new PolicySetDefinitionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyClient", "2019-09-01"); + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionImpl.java new file mode 100644 index 000000000000..a55ad9bb76a3 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionImpl.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyType; +import java.util.Map; +import com.microsoft.azure.management.policy.v2019_09_01.ParameterDefinitionsValue; + +class PolicyDefinitionImpl extends CreatableUpdatableImpl implements PolicyDefinition, PolicyDefinition.Definition, PolicyDefinition.Update { + private String policyDefinitionName; + private final PolicyManager manager; + + PolicyDefinitionImpl(String name, PolicyManager manager) { + super(name, new PolicyDefinitionInner()); + this.manager = manager; + // Set resource name + this.policyDefinitionName = name; + // + } + + PolicyDefinitionImpl(PolicyDefinitionInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policyDefinitionName = inner.name(); + // set resource ancestor and positional variables + this.policyDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "policyDefinitions"); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.createOrUpdateAsync(this.policyDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.createOrUpdateAsync(this.policyDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.getAsync(this.policyDefinitionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String mode() { + return this.inner().mode(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map parameters() { + return this.inner().parameters(); + } + + @Override + public Object policyRule() { + return this.inner().policyRule(); + } + + @Override + public PolicyType policyType() { + return this.inner().policyType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyDefinitionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicyDefinitionImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicyDefinitionImpl withMode(String mode) { + this.inner().withMode(mode); + return this; + } + + @Override + public PolicyDefinitionImpl withParameters(Map parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicyDefinitionImpl withPolicyRule(Object policyRule) { + this.inner().withPolicyRule(policyRule); + return this; + } + + @Override + public PolicyDefinitionImpl withPolicyType(PolicyType policyType) { + this.inner().withPolicyType(policyType); + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionInner.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionInner.java new file mode 100644 index 000000000000..0e2b1f216c96 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionInner.java @@ -0,0 +1,210 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.management.policy.v2019_09_01.PolicyType; +import java.util.Map; +import com.microsoft.azure.management.policy.v2019_09_01.ParameterDefinitionsValue; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy definition. + */ +@JsonFlatten +public class PolicyDefinitionInner extends ProxyResource { + /** + * The type of policy definition. Possible values are NotSpecified, + * BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', + * 'BuiltIn', 'Custom', 'Static'. + */ + @JsonProperty(value = "properties.policyType") + private PolicyType policyType; + + /** + * The policy definition mode. Some examples are All, Indexed, + * Microsoft.KeyVault.Data. + */ + @JsonProperty(value = "properties.mode") + private String mode; + + /** + * The display name of the policy definition. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The policy definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy rule. + */ + @JsonProperty(value = "properties.policyRule") + private Object policyRule; + + /** + * The policy definition metadata. Metadata is an open ended object and is + * typically a collection of key value pairs. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The parameter definitions for parameters used in the policy rule. The + * keys are the parameter names. + */ + @JsonProperty(value = "properties.parameters") + private Map parameters; + + /** + * Get the type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static'. + * + * @return the policyType value + */ + public PolicyType policyType() { + return this.policyType; + } + + /** + * Set the type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static'. + * + * @param policyType the policyType value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withPolicyType(PolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Get the policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + * + * @return the mode value + */ + public String mode() { + return this.mode; + } + + /** + * Set the policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + * + * @param mode the mode value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withMode(String mode) { + this.mode = mode; + return this; + } + + /** + * Get the display name of the policy definition. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy definition. + * + * @param displayName the displayName value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policy definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the policy definition description. + * + * @param description the description value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy rule. + * + * @return the policyRule value + */ + public Object policyRule() { + return this.policyRule; + } + + /** + * Set the policy rule. + * + * @param policyRule the policyRule value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withPolicyRule(Object policyRule) { + this.policyRule = policyRule; + return this; + } + + /** + * Get the policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + * + * @param metadata the metadata value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the parameter definitions for parameters used in the policy rule. The keys are the parameter names. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameter definitions for parameters used in the policy rule. The keys are the parameter names. + * + * @param parameters the parameters value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsImpl.java new file mode 100644 index 000000000000..c4bb81bab164 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsImpl.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinition; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicyDefinitionsImpl extends WrapperImpl implements PolicyDefinitions { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicyDefinitionsImpl(PolicyManager manager) { + super(manager.inner().policyDefinitions()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicyDefinitionInner inner) { + return Observable.just((PolicyDefinition) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicyDefinitionImpl define(String name) { + return wrapModel(name); + } + + private PolicyDefinitionImpl wrapModel(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + + private PolicyDefinitionImpl wrapModel(String name) { + return new PolicyDefinitionImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.deleteAsync(policyDefinitionName).toCompletable(); + } + + @Override + public Observable getAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.getAsync(policyDefinitionName) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBuiltInAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.getBuiltInAsync(policyDefinitionName) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + PolicyDefinitionsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupAsync(policyDefinitionName, managementGroupId, parameters) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(policyDefinitionName, managementGroupId).toCompletable(); + } + + @Override + public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.getAtManagementGroupAsync(policyDefinitionName, managementGroupId) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBuiltInAsync() { + PolicyDefinitionsInner client = this.inner(); + return client.listBuiltInAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicyDefinitionsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicyDefinitionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsInner.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsInner.java new file mode 100644 index 000000000000..bf7ac96565eb --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyDefinitionsInner.java @@ -0,0 +1,1410 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyDefinitions. + */ +public class PolicyDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private PolicyDefinitionsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicyDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicyDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> createOrUpdate(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicyDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> get(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions getBuiltIn" }) + @GET("providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> getBuiltIn(@Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions createOrUpdateAtManagementGroup" }) + @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> createOrUpdateAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicyDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions deleteAtManagementGroup" }) + @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions getAtManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> getAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions listBuiltIn" }) + @GET("providers/Microsoft.Authorization/policyDefinitions") + Observable> listBuiltIn(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions listBuiltInNext" }) + @GET + Observable> listBuiltInNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner createOrUpdate(String policyDefinitionName, PolicyDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(policyDefinitionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String policyDefinitionName) { + deleteWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String policyDefinitionName) { + return deleteWithServiceResponseAsync(policyDefinitionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policyDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner get(String policyDefinitionName) { + return getWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getAsync(String policyDefinitionName) { + return getWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policyDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner getBuiltIn(String policyDefinitionName) { + return getBuiltInWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getBuiltInAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getBuiltInAsync(String policyDefinitionName) { + return getBuiltInWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getBuiltInWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getBuiltIn(policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBuiltInDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner createOrUpdateAtManagementGroup(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAtManagementGroup(policyDefinitionName, managementGroupId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtManagementGroup(String policyDefinitionName, String managementGroupId) { + deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + return deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtManagementGroup(policyDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner getAtManagementGroup(String policyDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtManagementGroup(policyDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listBuiltIn() { + ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listBuiltInAsync() { + return listBuiltInWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listBuiltInWithServiceResponseAsync() { + return listBuiltInSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBuiltIn(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + ServiceResponse> * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listBuiltInNext(final String nextPageLink) { + ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listBuiltInNextAsync(final String nextPageLink) { + return listBuiltInNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyManager.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyManager.java new file mode 100644 index 000000000000..6d24552d8a47 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicyManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyAssignments; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitions; +import com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Authorization resource management. + */ +public final class PolicyManager extends ManagerCore { + private PolicyAssignments policyAssignments; + private PolicyDefinitions policyDefinitions; + private PolicySetDefinitions policySetDefinitions; + /** + * Get a Configurable instance that can be used to create PolicyManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new PolicyManager.ConfigurableImpl(); + } + /** + * Creates an instance of PolicyManager that exposes Authorization resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the PolicyManager + */ + public static PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new PolicyManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of PolicyManager that exposes Authorization resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the PolicyManager + */ + public static PolicyManager authenticate(RestClient restClient, String subscriptionId) { + return new PolicyManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of PolicyManager that exposes Authorization management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Authorization management API entry points that work across subscriptions + */ + PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage PolicyAssignments. + */ + public PolicyAssignments policyAssignments() { + if (this.policyAssignments == null) { + this.policyAssignments = new PolicyAssignmentsImpl(this); + } + return this.policyAssignments; + } + + /** + * @return Entry point to manage PolicyDefinitions. + */ + public PolicyDefinitions policyDefinitions() { + if (this.policyDefinitions == null) { + this.policyDefinitions = new PolicyDefinitionsImpl(this); + } + return this.policyDefinitions; + } + + /** + * @return Entry point to manage PolicySetDefinitions. + */ + public PolicySetDefinitions policySetDefinitions() { + if (this.policySetDefinitions == null) { + this.policySetDefinitions = new PolicySetDefinitionsImpl(this); + } + return this.policySetDefinitions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return PolicyManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private PolicyManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new PolicyClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionImpl.java new file mode 100644 index 000000000000..0e203d16e3f8 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionImpl.java @@ -0,0 +1,167 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyType; +import java.util.Map; +import com.microsoft.azure.management.policy.v2019_09_01.ParameterDefinitionsValue; +import java.util.List; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitionReference; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitionGroup; + +class PolicySetDefinitionImpl extends CreatableUpdatableImpl implements PolicySetDefinition, PolicySetDefinition.Definition, PolicySetDefinition.Update { + private String policySetDefinitionName; + private final PolicyManager manager; + + PolicySetDefinitionImpl(String name, PolicyManager manager) { + super(name, new PolicySetDefinitionInner()); + this.manager = manager; + // Set resource name + this.policySetDefinitionName = name; + // + } + + PolicySetDefinitionImpl(PolicySetDefinitionInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policySetDefinitionName = inner.name(); + // set resource ancestor and positional variables + this.policySetDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "policySetDefinitions"); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.createOrUpdateAsync(this.policySetDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.createOrUpdateAsync(this.policySetDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.getAsync(this.policySetDefinitionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map parameters() { + return this.inner().parameters(); + } + + @Override + public List policyDefinitionGroups() { + return this.inner().policyDefinitionGroups(); + } + + @Override + public List policyDefinitions() { + return this.inner().policyDefinitions(); + } + + @Override + public PolicyType policyType() { + return this.inner().policyType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicySetDefinitionImpl withPolicyDefinitions(List policyDefinitions) { + this.inner().withPolicyDefinitions(policyDefinitions); + return this; + } + + @Override + public PolicySetDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicySetDefinitionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicySetDefinitionImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicySetDefinitionImpl withParameters(Map parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicySetDefinitionImpl withPolicyDefinitionGroups(List policyDefinitionGroups) { + this.inner().withPolicyDefinitionGroups(policyDefinitionGroups); + return this; + } + + @Override + public PolicySetDefinitionImpl withPolicyType(PolicyType policyType) { + this.inner().withPolicyType(policyType); + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionInner.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionInner.java new file mode 100644 index 000000000000..0a01d8d55839 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionInner.java @@ -0,0 +1,213 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.management.policy.v2019_09_01.PolicyType; +import java.util.Map; +import com.microsoft.azure.management.policy.v2019_09_01.ParameterDefinitionsValue; +import java.util.List; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitionReference; +import com.microsoft.azure.management.policy.v2019_09_01.PolicyDefinitionGroup; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy set definition. + */ +@JsonFlatten +public class PolicySetDefinitionInner extends ProxyResource { + /** + * The type of policy definition. Possible values are NotSpecified, + * BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', + * 'BuiltIn', 'Custom', 'Static'. + */ + @JsonProperty(value = "properties.policyType") + private PolicyType policyType; + + /** + * The display name of the policy set definition. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The policy set definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy set definition metadata. Metadata is an open ended object + * and is typically a collection of key value pairs. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The policy set definition parameters that can be used in policy + * definition references. + */ + @JsonProperty(value = "properties.parameters") + private Map parameters; + + /** + * An array of policy definition references. + */ + @JsonProperty(value = "properties.policyDefinitions", required = true) + private List policyDefinitions; + + /** + * The metadata describing groups of policy definition references within + * the policy set definition. + */ + @JsonProperty(value = "properties.policyDefinitionGroups") + private List policyDefinitionGroups; + + /** + * Get the type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static'. + * + * @return the policyType value + */ + public PolicyType policyType() { + return this.policyType; + } + + /** + * Set the type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom', 'Static'. + * + * @param policyType the policyType value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyType(PolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Get the display name of the policy set definition. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy set definition. + * + * @param displayName the displayName value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policy set definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the policy set definition description. + * + * @param description the description value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. + * + * @param metadata the metadata value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the policy set definition parameters that can be used in policy definition references. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the policy set definition parameters that can be used in policy definition references. + * + * @param parameters the parameters value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get an array of policy definition references. + * + * @return the policyDefinitions value + */ + public List policyDefinitions() { + return this.policyDefinitions; + } + + /** + * Set an array of policy definition references. + * + * @param policyDefinitions the policyDefinitions value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyDefinitions(List policyDefinitions) { + this.policyDefinitions = policyDefinitions; + return this; + } + + /** + * Get the metadata describing groups of policy definition references within the policy set definition. + * + * @return the policyDefinitionGroups value + */ + public List policyDefinitionGroups() { + return this.policyDefinitionGroups; + } + + /** + * Set the metadata describing groups of policy definition references within the policy set definition. + * + * @param policyDefinitionGroups the policyDefinitionGroups value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyDefinitionGroups(List policyDefinitionGroups) { + this.policyDefinitionGroups = policyDefinitionGroups; + return this; + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsImpl.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsImpl.java new file mode 100644 index 000000000000..031fa55cb097 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsImpl.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinition; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicySetDefinitionsImpl extends WrapperImpl implements PolicySetDefinitions { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicySetDefinitionsImpl(PolicyManager manager) { + super(manager.inner().policySetDefinitions()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicySetDefinitionInner inner) { + return Observable.just((PolicySetDefinition) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicySetDefinitionImpl define(String name) { + return wrapModel(name); + } + + private PolicySetDefinitionImpl wrapModel(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + + private PolicySetDefinitionImpl wrapModel(String name) { + return new PolicySetDefinitionImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.deleteAsync(policySetDefinitionName).toCompletable(); + } + + @Override + public Observable getAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.getAsync(policySetDefinitionName) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBuiltInAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.getBuiltInAsync(policySetDefinitionName) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + PolicySetDefinitionsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupAsync(policySetDefinitionName, managementGroupId, parameters) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(policySetDefinitionName, managementGroupId).toCompletable(); + } + + @Override + public Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.getAtManagementGroupAsync(policySetDefinitionName, managementGroupId) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBuiltInAsync() { + PolicySetDefinitionsInner client = this.inner(); + return client.listBuiltInAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicySetDefinitionsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicySetDefinitionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsInner.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsInner.java new file mode 100644 index 000000000000..d3ff78e181cd --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/PolicySetDefinitionsInner.java @@ -0,0 +1,1412 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_09_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicySetDefinitions. + */ +public class PolicySetDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private PolicySetDefinitionsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicySetDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicySetDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicySetDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicySetDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicySetDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> createOrUpdate(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicySetDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> get(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions getBuiltIn" }) + @GET("providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> getBuiltIn(@Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions listBuiltIn" }) + @GET("providers/Microsoft.Authorization/policySetDefinitions") + Observable> listBuiltIn(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions createOrUpdateAtManagementGroup" }) + @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> createOrUpdateAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicySetDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions deleteAtManagementGroup" }) + @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions getAtManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> getAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions listBuiltInNext" }) + @GET + Observable> listBuiltInNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_09_01.PolicySetDefinitions listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(policySetDefinitionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String policySetDefinitionName) { + deleteWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String policySetDefinitionName) { + return deleteWithServiceResponseAsync(policySetDefinitionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policySetDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner get(String policySetDefinitionName) { + return getWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getAsync(String policySetDefinitionName) { + return getWithServiceResponseAsync(policySetDefinitionName).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policySetDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner getBuiltIn(String policySetDefinitionName) { + return getBuiltInWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getBuiltInAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getBuiltInAsync(String policySetDefinitionName) { + return getBuiltInWithServiceResponseAsync(policySetDefinitionName).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getBuiltInWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getBuiltIn(policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBuiltInDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listBuiltIn() { + ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listBuiltInAsync() { + return listBuiltInWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listBuiltInWithServiceResponseAsync() { + return listBuiltInSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBuiltIn(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner createOrUpdateAtManagementGroup(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAtManagementGroup(policySetDefinitionName, managementGroupId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) { + deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + return deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtManagementGroup(policySetDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner getAtManagementGroup(String policySetDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtManagementGroup(policySetDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + ServiceResponse> * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listBuiltInNext(final String nextPageLink) { + ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listBuiltInNextAsync(final String nextPageLink) { + return listBuiltInNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/package-info.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/package-info.java new file mode 100644 index 000000000000..74d1e40baa30 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for PolicyClient. + * To manage and control access to your resources, you can define customized policies and assign them at a scope. + */ +package com.microsoft.azure.management.policy.v2019_09_01.implementation; diff --git a/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/package-info.java b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/package-info.java new file mode 100644 index 000000000000..ea543207d2a4 --- /dev/null +++ b/sdk/policy/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/policy/v2019_09_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for PolicyClient. + * To manage and control access to your resources, you can define customized policies and assign them at a scope. + */ +package com.microsoft.azure.management.policy.v2019_09_01; diff --git a/sdk/policy/pom.mgmt.xml b/sdk/policy/pom.mgmt.xml index 7b602b325367..30d50d124b6a 100644 --- a/sdk/policy/pom.mgmt.xml +++ b/sdk/policy/pom.mgmt.xml @@ -13,5 +13,6 @@ mgmt-v2018_03_01 mgmt-v2018_05_01 mgmt-v2019_06_01 + mgmt-v2019_09_01 diff --git a/sdk/servicebus/microsoft-azure-servicebus/pom.xml b/sdk/servicebus/microsoft-azure-servicebus/pom.xml index ddf4c9c9c147..b2d3bf16a939 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/pom.xml +++ b/sdk/servicebus/microsoft-azure-servicebus/pom.xml @@ -78,7 +78,7 @@ com.microsoft.azure azure-client-authentication - 1.6.7 + 1.7.0 compile diff --git a/sdk/spring/ci.yml b/sdk/spring/ci.yml new file mode 100644 index 000000000000..1e60c2d535b3 --- /dev/null +++ b/sdk/spring/ci.yml @@ -0,0 +1,43 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + - repository: azure-sdk-tools + type: github + name: Azure/azure-sdk-tools + endpoint: azure + + trigger: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/spring/ + + pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/spring/ + + stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: spring + Artifacts: + - name: azure-spring-something + safeName: azurespringsomething + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md index e13e5fc07e70..3db2ff62b2c7 100644 --- a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md @@ -1,5 +1,8 @@ -# Change Log azure-storage-blob-batch -## Version 12.1.0 (2019-12-04) +# Release History + +## 12.2.0-beta.1 (Unreleased) + +## 12.1.0 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob-batch_12.1.0/sdk/storage/azure-storage-blob-batch/README.md) and @@ -8,12 +11,12 @@ and - Upgraded to version 1.1.0 of Azure Core. - Upgraded to version 12.1.0 of Azure Storage Blob. -## Version 12.0.0 (2019-10-31) +## 12.0.0 (2019-10-31) - Added BlobBatchStorageException - Changed exception throwing to throw StorageBlobException on invalid request and BlobBatchStorageException when batch operations fail -## Version 12.0.0-preview.4 (2019-10-8) +## 12.0.0-preview.4 (2019-10-8) For details on the Azure SDK for Java (October 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview4-java). This package's diff --git a/sdk/storage/azure-storage-blob-batch/README.md b/sdk/storage/azure-storage-blob-batch/README.md index 551b0e04f623..90beee0bb122 100644 --- a/sdk/storage/azure-storage-blob-batch/README.md +++ b/sdk/storage/azure-storage-blob-batch/README.md @@ -22,7 +22,7 @@ definition, such as text or binary data. com.azure azure-storage-blob-batch - 12.1.0 + 12.2.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -41,7 +41,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-storage-blob-batch - 12.1.0 + 12.2.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index a4875c005fa5..5c832199c9e4 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 com.azure @@ -65,7 +65,7 @@ com.azure azure-storage-blob - 12.2.0-beta.1 + 12.2.0-beta.2 org.slf4j @@ -86,7 +86,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatch.java b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatch.java index fc3fcb18a337..7ed8f2af62a1 100644 --- a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatch.java +++ b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatch.java @@ -8,12 +8,10 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.rest.Response; import com.azure.core.util.UrlBuilder; -import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.BlobClientBuilder; @@ -22,24 +20,18 @@ import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.common.Utility; import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy; -import reactor.core.Disposable; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.util.context.Context; import java.net.MalformedURLException; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.Deque; -import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; -import java.util.concurrent.atomic.AtomicInteger; + +import static com.azure.core.util.FluxUtil.monoError; /** * This class allows for batching of multiple Azure Storage operations in a single request via {@link @@ -55,17 +47,9 @@ */ public final class BlobBatch { private static final String X_MS_VERSION = "x-ms-version"; - private static final String BATCH_REQUEST_CONTENT_ID = "Batch-Request-Content-Id"; private static final String BATCH_REQUEST_URL_PATH = "Batch-Request-Url-Path"; - private static final String CONTENT_ID = "Content-Id"; - private static final String BATCH_BOUNDARY_TEMPLATE = "batch_%s"; - private static final String REQUEST_CONTENT_TYPE_TEMPLATE = "multipart/mixed; boundary=%s"; - private static final String BATCH_OPERATION_CONTENT_TYPE = "Content-Type: application/http"; - private static final String BATCH_OPERATION_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding: binary"; - private static final String BATCH_OPERATION_CONTENT_ID_TEMPLATE = "Content-ID: %d"; - private static final String HTTP_VERSION = "HTTP/1.1"; - private static final String OPERATION_TEMPLATE = "%s %s %s"; - private static final String HEADER_TEMPLATE = "%s: %s"; + private static final String BATCH_OPERATION_RESPONSE = "Batch-Operation-Response"; + private static final String BATCH_OPERATION_INFO = "Batch-Operation-Info"; private static final String PATH_TEMPLATE = "%s/%s"; /* @@ -79,23 +63,12 @@ public final class BlobBatch { private final BlobAsyncClient blobAsyncClient; - private final Deque>> batchOperationQueue; - private final List batchRequest; - private final Map> batchMapping; - - private final AtomicInteger contentId; - private final String batchBoundary; - private final String contentType; - + private Deque> batchOperationQueue; private BlobBatchType batchType; BlobBatch(String accountUrl, HttpPipeline pipeline) { - this.contentId = new AtomicInteger(); - this.batchBoundary = String.format(BATCH_BOUNDARY_TEMPLATE, UUID.randomUUID()); - this.contentType = String.format(REQUEST_CONTENT_TYPE_TEMPLATE, batchBoundary); - boolean batchHeadersPolicySet = false; - HttpPipelineBuilder batchPipelineBuilder = new HttpPipelineBuilder().httpClient(this::setupBatchOperation); + HttpPipelineBuilder batchPipelineBuilder = new HttpPipelineBuilder(); for (int i = 0; i < pipeline.getPolicyCount(); i++) { HttpPipelinePolicy policy = pipeline.getPolicy(i); @@ -112,6 +85,8 @@ public final class BlobBatch { batchPipelineBuilder.policies(this::cleanseHeaders, this::setRequestUrl); } + batchPipelineBuilder.policies(this::buildBatchOperation); + this.blobAsyncClient = new BlobClientBuilder() .endpoint(accountUrl) .blobName("") @@ -119,8 +94,6 @@ public final class BlobBatch { .buildAsyncClient(); this.batchOperationQueue = new ConcurrentLinkedDeque<>(); - this.batchRequest = new ArrayList<>(); - this.batchMapping = new ConcurrentHashMap<>(); } /** @@ -287,12 +260,9 @@ private Response setBlobAccessTierHelper(String urlPath, AccessTier access private Response createBatchOperation(Mono> response, String urlPath, int... expectedStatusCodes) { - int id = contentId.getAndIncrement(); - batchOperationQueue.add(response - .subscriberContext(Context.of(BATCH_REQUEST_CONTENT_ID, id, BATCH_REQUEST_URL_PATH, urlPath))); - BlobBatchOperationResponse batchOperationResponse = new BlobBatchOperationResponse<>(expectedStatusCodes); - batchMapping.put(id, batchOperationResponse); + batchOperationQueue.add(new BlobBatchOperation<>(batchOperationResponse, response, urlPath)); + return batchOperationResponse; } @@ -309,49 +279,30 @@ private void setBatchType(BlobBatchType batchType) { } } - Flux getBody() { + Mono prepareBlobBatchSubmission() { if (batchOperationQueue.isEmpty()) { - throw logger.logExceptionAsError(new UnsupportedOperationException("Empty batch requests aren't allowed.")); + return monoError(logger, new UnsupportedOperationException("Empty batch requests aren't allowed.")); } - // 'flatMap' the requests to trigger them to run through the pipeline. - Disposable disposable = Flux.fromStream(batchOperationQueue.stream()) - .flatMap(batchOperation -> batchOperation) - .subscribe(); - - /* Wait until the 'Flux' is disposed of (aka complete) instead of blocking as this will prevent Reactor from - * throwing an exception if this was ran in a Reactor thread. - */ - while (!disposable.isDisposed()) { - // This is used as opposed to block as it won't trigger an exception if ran in a Reactor thread. - } - - this.batchRequest.add(ByteBuffer.wrap( - String.format("--%s--%s", batchBoundary, BlobBatchHelper.HTTP_NEWLINE).getBytes(StandardCharsets.UTF_8))); - - return Flux.fromIterable(batchRequest); - } - - long getContentLength() { - long contentLength = 0; - - for (ByteBuffer request : batchRequest) { - contentLength += request.remaining(); - } - - return contentLength; - } - - String getContentType() { - return contentType; - } - - BlobBatchOperationResponse getBatchRequest(int contentId) { - return batchMapping.get(contentId); - } - - int getOperationCount() { - return batchMapping.size(); + BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo(); + Deque> operations = batchOperationQueue; + + // Begin a new batch. + batchOperationQueue = new ConcurrentLinkedDeque<>(); + + return Flux.generate(sink -> { + if (operations.isEmpty()) { + operationInfo.finalizeBatchOperations(); + sink.complete(); + } else { + BlobBatchOperation batchOperation = operations.pop(); + sink.next(batchOperation.getResponse() + .subscriberContext(Context.of(BATCH_REQUEST_URL_PATH, batchOperation.getRequestUrlPath(), + BATCH_OPERATION_RESPONSE, batchOperation.getBatchOperationResponse(), + BATCH_OPERATION_INFO, operationInfo)) + .subscribe()); + } + }).then(Mono.just(operationInfo)); } /* @@ -369,9 +320,6 @@ private Mono cleanseHeaders(HttpPipelineCallContext context, HttpP context.getHttpRequest().setHeaders(new HttpHeaders(headers)); - // Add the "Content-Id" header which allows this request to be mapped to the response. - context.getHttpRequest().setHeader(CONTENT_ID, context.getData(BATCH_REQUEST_CONTENT_ID).get().toString()); - return next.process(); } @@ -396,38 +344,12 @@ private Mono setRequestUrl(HttpPipelineCallContext context, HttpPi * This will "send" the batch operation request when triggered, it simply acts as a way to build and write the * batch operation into the overall request and then returns nothing as the response. */ - private Mono setupBatchOperation(HttpRequest request) { - return Mono.fromRunnable(() -> { - int contentId = Integer.parseInt(request.getHeaders().remove(CONTENT_ID).getValue()); - - StringBuilder batchRequestBuilder = new StringBuilder(); - appendWithNewline(batchRequestBuilder, "--" + batchBoundary); - appendWithNewline(batchRequestBuilder, BATCH_OPERATION_CONTENT_TYPE); - appendWithNewline(batchRequestBuilder, BATCH_OPERATION_CONTENT_TRANSFER_ENCODING); - appendWithNewline(batchRequestBuilder, String.format(BATCH_OPERATION_CONTENT_ID_TEMPLATE, contentId)); - batchRequestBuilder.append(BlobBatchHelper.HTTP_NEWLINE); - - String method = request.getHttpMethod().toString(); - String urlPath = request.getUrl().getPath(); - String urlQuery = request.getUrl().getQuery(); - if (!CoreUtils.isNullOrEmpty(urlQuery)) { - urlPath = urlPath + "?" + urlQuery; - } - appendWithNewline(batchRequestBuilder, String.format(OPERATION_TEMPLATE, method, urlPath, HTTP_VERSION)); - - request.getHeaders().stream() - .filter(header -> !X_MS_VERSION.equalsIgnoreCase(header.getName())) - .forEach(header -> appendWithNewline(batchRequestBuilder, - String.format(HEADER_TEMPLATE, header.getName(), header.getValue()))); - - batchRequestBuilder.append(BlobBatchHelper.HTTP_NEWLINE); - - batchRequest.add(ByteBuffer.wrap(batchRequestBuilder.toString().getBytes(StandardCharsets.UTF_8))); - batchMapping.get(contentId).setRequest(request); - }); - } + private Mono buildBatchOperation(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + BlobBatchOperationInfo operationInfo = (BlobBatchOperationInfo) context.getData(BATCH_OPERATION_INFO).get(); + BlobBatchOperationResponse batchOperationResponse = + (BlobBatchOperationResponse) context.getData(BATCH_OPERATION_RESPONSE).get(); + operationInfo.addBatchOperation(batchOperationResponse, context.getHttpRequest()); - private void appendWithNewline(StringBuilder stringBuilder, String value) { - stringBuilder.append(value).append(BlobBatchHelper.HTTP_NEWLINE); + return Mono.empty(); } } diff --git a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java index 5834e825e762..1e316b2f5102 100644 --- a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java +++ b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java @@ -12,8 +12,8 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceVersion; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; @@ -22,6 +22,7 @@ import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.common.implementation.StorageImplUtils; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.time.Duration; @@ -103,8 +104,8 @@ public Mono submitBatch(BlobBatch batch) { * @return A response only containing header and status code information, used to indicate that the batch operation * has completed. * @throws BlobStorageException If the batch request is malformed. - * @throws BlobBatchStorageException If {@code throwOnAnyFailure} is {@code true} and any request in the - * {@link BlobBatch} failed. + * @throws BlobBatchStorageException If {@code throwOnAnyFailure} is {@code true} and any request in the {@link + * BlobBatch} failed. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> submitBatchWithResponse(BlobBatch batch, boolean throwOnAnyFailure) { @@ -116,9 +117,12 @@ public Mono> submitBatchWithResponse(BlobBatch batch, boolean thr } Mono> submitBatchWithResponse(BlobBatch batch, boolean throwOnAnyFailure, Context context) { - return client.services().submitBatchWithRestResponseAsync( - batch.getBody(), batch.getContentLength(), batch.getContentType(), context) - .flatMap(response -> BlobBatchHelper.mapBatchResponse(batch, response, throwOnAnyFailure, logger)); + return batch.prepareBlobBatchSubmission() + .flatMap(batchOperationInfo -> client.services() + .submitBatchWithRestResponseAsync(Flux.fromIterable(batchOperationInfo.getBody()), + batchOperationInfo.getContentLength(), batchOperationInfo.getContentType(), context) + .flatMap(response -> + BlobBatchHelper.mapBatchResponse(batchOperationInfo, response, throwOnAnyFailure, logger))); } /** diff --git a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchHelper.java b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchHelper.java index 862c11fe3a6f..b8d765d429ee 100644 --- a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchHelper.java +++ b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchHelper.java @@ -51,8 +51,8 @@ class BlobBatchHelper { .compile("application\\/http", Pattern.CASE_INSENSITIVE); // This method connects the batch response values to the individual batch operations based on their Content-Id - static Mono> mapBatchResponse(BlobBatch batch, ServicesSubmitBatchResponse batchResponse, - boolean throwOnAnyFailure, ClientLogger logger) { + static Mono> mapBatchResponse(BlobBatchOperationInfo batchOperationInfo, + ServicesSubmitBatchResponse batchResponse, boolean throwOnAnyFailure, ClientLogger logger) { /* * Content-Type will contain the boundary for each batch response. The expected format is: * "Content-Type: multipart/mixed; boundary=batchresponse_66925647-d0cb-4109-b6d3-28efe3e1e5ed" @@ -74,7 +74,7 @@ static Mono> mapBatchResponse(BlobBatch batch, ServicesSubm List exceptions = new ArrayList<>(); String[] subResponses = body.split("--" + boundary); - if (subResponses.length == 3 && batch.getOperationCount() != 1) { + if (subResponses.length == 3 && batchOperationInfo.getOperationCount() != 1) { String[] exceptionSections = subResponses[1].split(HTTP_NEWLINE + HTTP_NEWLINE); int statusCode = getStatusCode(exceptionSections[1], logger); HttpHeaders headers = getHttpHeaders(exceptionSections[1]); @@ -95,7 +95,7 @@ static Mono> mapBatchResponse(BlobBatch batch, ServicesSubm // The first section will contain batching metadata. BlobBatchOperationResponse batchOperationResponse = - getBatchOperation(batch, subResponseSections[0], logger); + getBatchOperation(batchOperationInfo, subResponseSections[0], logger); // The second section will contain status code and header information. batchOperationResponse.setStatusCode(getStatusCode(subResponseSections[1], logger)); @@ -117,8 +117,8 @@ static Mono> mapBatchResponse(BlobBatch batch, ServicesSubm })); } - private static BlobBatchOperationResponse getBatchOperation(BlobBatch batch, String responseBatchInfo, - ClientLogger logger) { + private static BlobBatchOperationResponse getBatchOperation(BlobBatchOperationInfo batchOperationInfo, + String responseBatchInfo, ClientLogger logger) { Matcher contentIdMatcher = CONTENT_ID_PATTERN.matcher(responseBatchInfo); int contentId; @@ -129,7 +129,7 @@ private static BlobBatchOperationResponse getBatchOperation(BlobBatch batch, new IllegalStateException("Batch operation response doesn't contain a 'Content-Id' header.")); } - return batch.getBatchRequest(contentId).setResponseReceived(); + return batchOperationInfo.getBatchRequest(contentId).setResponseReceived(); } private static int getStatusCode(String responseMetadata, ClientLogger logger) { diff --git a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperation.java b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperation.java new file mode 100644 index 000000000000..711d6fc2c94b --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperation.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.batch; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.rest.Response; +import reactor.core.publisher.Mono; + +/** + * Contains the information about a single {@link BlobBatch} operation. + * + * @param Type that is returned by the operation. + */ +@Immutable +final class BlobBatchOperation { + private final BlobBatchOperationResponse batchOperationResponse; + private final Mono> response; + private final String requestUrlPath; + + /* + * Creates a {@link BlobBatchOperation} which contains all information that is needed to execute the individual + * operation. + * + * @param batchOperationResponse {@link BlobBatchOperationResponse} which is returned to the caller of the batch + * operation. + * @param response Response which is returned from the API which the batch operation uses. This is used to generate + * the request in a deferred manner. + * @param requestUrlPath Relative path of the blob in the batch operation. + */ + BlobBatchOperation(BlobBatchOperationResponse batchOperationResponse, Mono> response, + String requestUrlPath) { + this.batchOperationResponse = batchOperationResponse; + this.response = response; + this.requestUrlPath = requestUrlPath; + } + + /* + * The {@link BlobBatchOperationResponse} which is returned to the caller of the batch operation. + * + * @return Response returned to the caller. + */ + BlobBatchOperationResponse getBatchOperationResponse() { + return batchOperationResponse; + } + + /* + * Response which is returned from the API which the batch operation uses. This is used to generate the + * request in a deferred manner. + * + * @return Response from the API which the batch operation uses. + */ + Mono> getResponse() { + return response; + } + + /* + * Relative path of the blob in the batch operation. + * + * @return Blob relative path. + */ + String getRequestUrlPath() { + return requestUrlPath; + } +} diff --git a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperationInfo.java b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperationInfo.java new file mode 100644 index 000000000000..bc8a7d49d092 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchOperationInfo.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.batch; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.HttpRequest; +import com.azure.core.util.CoreUtils; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Contains the information necessary for submitting a batch. + */ +@Immutable +final class BlobBatchOperationInfo { + private static final String X_MS_VERSION = "x-ms-version"; + private static final String BATCH_BOUNDARY_TEMPLATE = "batch_%s"; + private static final String REQUEST_CONTENT_TYPE_TEMPLATE = "multipart/mixed; boundary=%s"; + private static final String BATCH_OPERATION_CONTENT_TYPE = "Content-Type: application/http"; + private static final String BATCH_OPERATION_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding: binary"; + private static final String BATCH_OPERATION_CONTENT_ID_TEMPLATE = "Content-ID: %d"; + private static final String HTTP_VERSION = "HTTP/1.1"; + private static final String OPERATION_TEMPLATE = "%s %s %s"; + private static final String HEADER_TEMPLATE = "%s: %s"; + + private final AtomicInteger contentId; + private final String batchBoundary; + private final String contentType; + private final Collection batchOperations; + private final Map> batchOperationResponseMap; + + /** + * Creates a {@link BlobBatchOperationInfo} which contains all information necessary for submitting a batch + * operation. + */ + BlobBatchOperationInfo() { + this.contentId = new AtomicInteger(); + this.batchBoundary = String.format(BATCH_BOUNDARY_TEMPLATE, UUID.randomUUID()); + this.contentType = String.format(REQUEST_CONTENT_TYPE_TEMPLATE, batchBoundary); + this.batchOperations = new ConcurrentLinkedQueue<>(); + this.batchOperationResponseMap = new ConcurrentHashMap<>(); + } + + /* + * Gets the body for the batch operation. + * + * @return Request body. + */ + Collection getBody() { + return batchOperations; + } + + /* + * Gets the size of the batch operation request. + * + * @return Size of the request body. + */ + long getContentLength() { + return batchOperations.stream().map(buffer -> (long) buffer.remaining()).reduce(0L, Long::sum); + } + + /* + * Gets the Content-Type header for the batch operation request. + * + * @return Content-Type header for the request. + */ + String getContentType() { + return contentType; + } + + /* + * Adds an operation to the operation set being submitted in the batch. + * + * @param batchOperation Operation to add to the batch. + * @param request The {@link HttpRequest} for the operation. + */ + void addBatchOperation(BlobBatchOperationResponse batchOperation, HttpRequest request) { + int contentId = this.contentId.getAndIncrement(); + + StringBuilder batchRequestBuilder = new StringBuilder(); + appendWithNewline(batchRequestBuilder, "--" + batchBoundary); + appendWithNewline(batchRequestBuilder, BATCH_OPERATION_CONTENT_TYPE); + appendWithNewline(batchRequestBuilder, BATCH_OPERATION_CONTENT_TRANSFER_ENCODING); + appendWithNewline(batchRequestBuilder, String.format(BATCH_OPERATION_CONTENT_ID_TEMPLATE, contentId)); + batchRequestBuilder.append(BlobBatchHelper.HTTP_NEWLINE); + + String method = request.getHttpMethod().toString(); + String urlPath = request.getUrl().getPath(); + String urlQuery = request.getUrl().getQuery(); + if (!CoreUtils.isNullOrEmpty(urlQuery)) { + urlPath = urlPath + "?" + urlQuery; + } + appendWithNewline(batchRequestBuilder, String.format(OPERATION_TEMPLATE, method, urlPath, HTTP_VERSION)); + + /* + * The 'x-ms-version' header is removed from batch operations as all batch operations will use the + * 'x-ms-version' used in the batch request. This header is illegal and will fail the batch request if present + * in any operation. + */ + request.getHeaders().stream() + .filter(header -> !X_MS_VERSION.equalsIgnoreCase(header.getName())) + .forEach(header -> appendWithNewline(batchRequestBuilder, + String.format(HEADER_TEMPLATE, header.getName(), header.getValue()))); + + batchRequestBuilder.append(BlobBatchHelper.HTTP_NEWLINE); + + batchOperationResponseMap.put(contentId, batchOperation.setRequest(request)); + batchOperations.add(ByteBuffer.wrap(batchRequestBuilder.toString().getBytes(StandardCharsets.UTF_8))); + } + + /* + * Completes the batch by adding the final boundary identifier to the request body. + */ + void finalizeBatchOperations() { + batchOperations.add(ByteBuffer.wrap(String.format("--%s--%s", batchBoundary, BlobBatchHelper.HTTP_NEWLINE) + .getBytes(StandardCharsets.UTF_8))); + } + + /* + * Gets the batch operation with the passed Content-ID. + * + * @param contentId Content-ID of the operation. + * @return The {@link BlobBatchOperationResponse} correlated to the passed Content-ID. + */ + BlobBatchOperationResponse getBatchRequest(int contentId) { + return batchOperationResponseMap.get(contentId); + } + + /* + * Gets the number of operations contained in the batch. + * + * @return Number of operations in the batch. + */ + int getOperationCount() { + return batchOperationResponseMap.size(); + } + + private static void appendWithNewline(StringBuilder stringBuilder, String value) { + stringBuilder.append(value).append(BlobBatchHelper.HTTP_NEWLINE); + } +} diff --git a/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/APISpec.groovy b/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/APISpec.groovy index 73bd51cc2e88..25715cb1cdeb 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/APISpec.groovy +++ b/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/APISpec.groovy @@ -98,6 +98,9 @@ class APISpec extends Specification { this.interceptorManager = new InterceptorManager(className + fullTestName, testMode) this.resourceNamer = new TestResourceNamer(className + testName, testMode, interceptorManager.getRecordedData()) + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + // If the test doesn't have the Requires tag record it in live mode. recordLiveMode = specificationContext.getCurrentIteration().getDescription().getAnnotation(Requires.class) == null diff --git a/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/BatchAPITest.groovy b/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/BatchAPITest.groovy index 08eec6875bcd..8995e8716b04 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/BatchAPITest.groovy +++ b/sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/BatchAPITest.groovy @@ -7,6 +7,7 @@ import com.azure.storage.blob.BlobServiceAsyncClient import com.azure.storage.blob.models.AccessTier import com.azure.storage.blob.models.BlobStorageException import com.azure.storage.blob.models.DeleteSnapshotsOptionType +import spock.lang.Unroll class BatchAPITest extends APISpec { static def setupCustomPolicyBatch(BlobServiceAsyncClient blobServiceAsyncClient, HttpPipelinePolicy customPolicy) { @@ -390,4 +391,55 @@ class BatchAPITest extends APISpec { then: thrown(BlobStorageException) } + + def "Single operation exception throws BlobBatchStorageException"() { + setup: + def containerName = generateContainerName() + def blobName1 = generateBlobName() + def batch = batchClient.getBlobBatch() + def containerClient = primaryBlobServiceClient.getBlobContainerClient(containerName) + containerClient.create() + + when: + def response1 = batch.deleteBlob(containerName, blobName1) + batchClient.submitBatch(batch) + + then: + thrown(BlobBatchStorageException) + + when: + response1.getStatusCode() + + then: + thrown(BlobStorageException) + } + + @Unroll + def "Submitting same batch many times"() { + setup: + def containerName = generateContainerName() + def blobName1 = generateBlobName() + def blobName2 = generateBlobName() + def containerClient = primaryBlobServiceClient.getBlobContainerClient(containerName) + containerClient.create() + containerClient.getBlobClient(blobName2).getPageBlobClient().create(0) + + when: + def batch = batchClient.getBlobBatch() + batch.deleteBlob(containerName, blobName1, DeleteSnapshotsOptionType.INCLUDE, null) + batch.deleteBlob(containerName, blobName2, DeleteSnapshotsOptionType.INCLUDE, null) + batchClient.submitBatch(batch) + + then: + thrown(BlobBatchStorageException) + + when: + batchClient.submitBatch(batch) + + then: + thrown(UnsupportedOperationException) + + where: + i << (1..20) + } } diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestaccessingbatchrequestbeforesubmissionthrows.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestaccessingbatchrequestbeforesubmissionthrows.json index 92a882d4d0d5..354eb1d057d1 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestaccessingbatchrequestbeforesubmissionthrows.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestaccessingbatchrequestbeforesubmissionthrows.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccessingbatchrequestbeforesubmissionthrows0598179640b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccessingbatchrequestbeforesubmissionthrows092993232a5?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "9913daa0-ca81-45b8-9504-48e20c291a96" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6f100f06-0bfc-4c42-9fa3-f1d039b0e1dc" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6D81C92", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D78277844554F1", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e35846-201e-006e-767a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "9913daa0-ca81-45b8-9504-48e20c291a96" + "x-ms-request-id" : "8dbb0e6b-701e-00d7-2960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "6f100f06-0bfc-4c42-9fa3-f1d039b0e1dc" }, "Exception" : null }, { @@ -25,8 +25,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccessingbatchrequestbeforesubmissionthrows&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "64f6535b-e5bf-43a6-ba79-6ba987e761a1" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "279f64a5-b29b-49c5-9491-ca48bbf23fe6" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -34,20 +34,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4af3-d01e-007b-677a-845bc6000000", - "Body" : "jtcaccessingbatchrequestbeforesubmissionthrowsjtcaccessingbatchrequestbeforesubmissionthrows0598179640bWed, 16 Oct 2019 23:38:09 GMT\"0x8D75291E6D81C92\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "64f6535b-e5bf-43a6-ba79-6ba987e761a1", + "x-ms-request-id" : "8dbb0e8f-701e-00d7-4b60-b47a51000000", + "Body" : "jtcaccessingbatchrequestbeforesubmissionthrowsjtcaccessingbatchrequestbeforesubmissionthrows092993232a5Mon, 16 Dec 2019 22:30:12 GMT\"0x8D78277844554F1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "279f64a5-b29b-49c5-9491-ca48bbf23fe6", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccessingbatchrequestbeforesubmissionthrows0598179640b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccessingbatchrequestbeforesubmissionthrows092993232a5?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c81c16d7-c1dd-436f-baaa-fd22db928c6a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d73ad3b3-af24-4615-abd7-5a6cffeffff5" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -55,11 +55,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35863-201e-006e-097a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "c81c16d7-c1dd-436f-baaa-fd22db928c6a" + "x-ms-request-id" : "8dbb0eab-701e-00d7-6660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "d73ad3b3-af24-4615-abd7-5a6cffeffff5" }, "Exception" : null } ], - "variables" : [ "jtcaccessingbatchrequestbeforesubmissionthrows0598179640b" ] + "variables" : [ "jtcaccessingbatchrequestbeforesubmissionthrows092993232a5" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulkdeleteblobs.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulkdeleteblobs.json index 0934af9f9e01..aed731a00001 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulkdeleteblobs.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulkdeleteblobs.json @@ -1,243 +1,243 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "1bf8a949-7019-4703-bff1-2fa273af35fc" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2cedade5-950d-46e6-a0c0-4febdcda1af3" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6EADE95", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D7827784551026", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4b17-d01e-007b-807a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "1bf8a949-7019-4703-bff1-2fa273af35fc" + "x-ms-request-id" : "8dbb0ec3-701e-00d7-7c60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "2cedade5-950d-46e6-a0c0-4febdcda1af3" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs1batchapitestbulkdeleteblobs9fd48471dc", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs1batchapitestbulkdeleteblobsb9583196ee", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "a37a151a-2751-4eb4-b523-6b67b480ed18" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8a3a1d8e-0d8e-4f0d-890a-dd29fc060edb" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6F2B468", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D78277845A9957", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e35885-201e-006e-257a-84995f000000", + "x-ms-request-id" : "8dbb0eda-701e-00d7-1160-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "a37a151a-2751-4eb4-b523-6b67b480ed18" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "8a3a1d8e-0d8e-4f0d-890a-dd29fc060edb" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs2batchapitestbulkdeleteblobs9fd9280665", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs2batchapitestbulkdeleteblobsb955043749", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c1ab4d10-38c0-49b1-9269-85eadaf5975f" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2c8f9209-12a7-4be8-949e-a31906b75d0a" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6F9E217", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D782778462FFD8", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4b44-d01e-007b-207a-845bc6000000", + "x-ms-request-id" : "8dbb0f00-701e-00d7-3460-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "c1ab4d10-38c0-49b1-9269-85eadaf5975f" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "2c8f9209-12a7-4be8-949e-a31906b75d0a" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs3batchapitestbulkdeleteblobs9fd3395172", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs3batchapitestbulkdeleteblobsb954883121", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c749d66b-77c7-4408-a69f-13809dbff1c1" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1e61a4e7-3b89-4605-9540-bc5772672bb3" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E701AC32", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D782778467E315", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e358a7-201e-006e-407a-84995f000000", + "x-ms-request-id" : "8dbb0f16-701e-00d7-4760-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "c749d66b-77c7-4408-a69f-13809dbff1c1" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "1e61a4e7-3b89-4605-9540-bc5772672bb3" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs4batchapitestbulkdeleteblobs9fd7051837", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs4batchapitestbulkdeleteblobsb950398700", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "7bbe107f-d640-45fd-b1a2-5f6e88b6ed5f" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1510164f-e061-4862-a605-84b8dc32e3f5" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E708165C", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D78277846D146F", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4b64-d01e-007b-397a-845bc6000000", + "x-ms-request-id" : "8dbb0f2a-701e-00d7-5b60-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "7bbe107f-d640-45fd-b1a2-5f6e88b6ed5f" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "1510164f-e061-4862-a605-84b8dc32e3f5" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs5batchapitestbulkdeleteblobs9fd79821de", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs5batchapitestbulkdeleteblobsb95907306e", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "08d035a1-304e-4108-aad1-eb2cf391d8de" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "94fc38f1-8b1e-4027-9561-7af81a3eb32d" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E70E325B", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D782778472E23E", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e358b9-201e-006e-517a-84995f000000", + "x-ms-request-id" : "8dbb0f45-701e-00d7-7260-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "08d035a1-304e-4108-aad1-eb2cf391d8de" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "94fc38f1-8b1e-4027-9561-7af81a3eb32d" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs6batchapitestbulkdeleteblobs9fd20411a5", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs6batchapitestbulkdeleteblobsb950154647", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "0b74031f-febe-41ec-9608-ce9dae8108dd" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1ca508d1-a448-4a74-b2a1-bd6e905b8538" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E7144E52", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D78277847A5E24", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4b88-d01e-007b-527a-845bc6000000", + "x-ms-request-id" : "8dbb0f73-701e-00d7-1d60-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "0b74031f-febe-41ec-9608-ce9dae8108dd" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "1ca508d1-a448-4a74-b2a1-bd6e905b8538" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs7batchapitestbulkdeleteblobs9fd399391c", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs7batchapitestbulkdeleteblobsb95422171b", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2107fc85-ff3a-4586-9a70-442ac3049a88" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2e5ad6fb-28ef-4ed2-8afc-4dd4e67207dd" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E71A6A49", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D782778482C4A4", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e358de-201e-006e-6e7a-84995f000000", + "x-ms-request-id" : "8dbb0f91-701e-00d7-3b60-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "2107fc85-ff3a-4586-9a70-442ac3049a88" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "2e5ad6fb-28ef-4ed2-8afc-4dd4e67207dd" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs8batchapitestbulkdeleteblobs9fd9842712", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs8batchapitestbulkdeleteblobsb958499677", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "1f579739-51ea-4778-85c2-d0a82e3103c9" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9da527ac-8d1d-491f-b4fc-98d6070a3f3f" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E7205F2D", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D7827784886B60", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4ba7-d01e-007b-677a-845bc6000000", + "x-ms-request-id" : "8dbb0fb1-701e-00d7-5860-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "1f579739-51ea-4778-85c2-d0a82e3103c9" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "9da527ac-8d1d-491f-b4fc-98d6070a3f3f" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs9batchapitestbulkdeleteblobs9fd16219c9", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs9batchapitestbulkdeleteblobsb95646460b", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "3f99972b-8074-48fe-b274-d7d9234c2313" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2581d8ef-ef77-4def-a8b3-660bc61417fc" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E7262CF5", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D7827784927FFB", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e358f9-201e-006e-047a-84995f000000", + "x-ms-request-id" : "8dbb0fdf-701e-00d7-0360-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "3f99972b-8074-48fe-b274-d7d9234c2313" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "2581d8ef-ef77-4def-a8b3-660bc61417fc" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da/javablobbulkdeleteblobs10batchapitestbulkdeleteblobs9fd13870e", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107/javablobbulkdeleteblobs10batchapitestbulkdeleteblobsb95141523", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2391f2be-9d93-4788-b17e-224f6954805c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b0f951c4-c3d4-4721-94d2-d9eed492f62d" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E72C48FA", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D782778497FF8F", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4bc7-d01e-007b-807a-845bc6000000", + "x-ms-request-id" : "8dbb1002-701e-00d7-2360-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "2391f2be-9d93-4788-b17e-224f6954805c" + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "b0f951c4-c3d4-4721-94d2-d9eed492f62d" }, "Exception" : null }, { @@ -245,9 +245,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2c050cbd-332b-4557-95bc-2c26a081a5ef", - "Content-Type" : "multipart/mixed; boundary=batch_f746c873-37cc-48a7-91cb-013489791109" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c50fdcab-40bb-4da4-815d-2b4ff8ec5327", + "Content-Type" : "multipart/mixed; boundary=batch_9844925e-a559-48e0-8760-f4c1e705b036" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -255,11 +255,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35911-201e-006e-177a-84995f000000", - "Body" : "--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c29\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 4494e438-bd2f-45ff-b6a7-3604dd5999a2\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c2b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 966e118a-7daf-4ac7-bd5f-4631eb6e2119\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 2\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c2c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c81c8895-b188-4599-8b0c-d6d06ba2d953\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 3\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c2d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: e90f75c2-109d-45e9-9817-cba688ff0244\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 4\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c2e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c6931c0b-7957-42ac-8bd5-83b2cd9bf931\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 5\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c2f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: cfb667a7-1059-48f5-8b37-548ddf895f65\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 6\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c30\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: ea9d07e8-00f7-4da4-99d9-c4b47de03f99\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 7\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c31\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 449beab8-5d20-45d3-b035-33725c2d2d57\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 8\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c32\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: d2c0f2f5-5d4f-4cdb-9535-989b8fb88506\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0\r\nContent-Type: application/http\r\nContent-ID: 9\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35911-201e-006e-177a-84995f1e4c33\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 5f1d0689-f573-4ffe-9157-0076cda2e07d\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0--", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "2c050cbd-332b-4557-95bc-2c26a081a5ef", - "Content-Type" : "multipart/mixed; boundary=batchresponse_f45d7245-6278-48db-a6c2-6de0a68bb3c0" + "x-ms-request-id" : "8dbb1020-701e-00d7-4160-b47a51000000", + "Body" : "--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c7a\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2d155b40-d752-4ada-9d89-99654bab1e51\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c7c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2d57a168-06c8-461c-ba30-cccc1ac878da\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 2\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c7d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: de133290-12bb-4aa1-8f30-a0ef1488e248\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 3\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c7e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 983d72ca-7f66-4818-aa73-42b05fde6fe8\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 4\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c7f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: b89df75b-888c-49f1-8e00-2aa46bfa218c\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 5\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c80\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: b694a55a-3784-4c96-808c-098898efc150\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 6\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c81\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 113a2557-e333-498f-a5be-39c796109236\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 7\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c82\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 478fb994-4801-4957-b946-943bb05e28c1\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 8\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c83\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: fe651db8-c98f-4624-b783-f0274ef30833\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3\r\nContent-Type: application/http\r\nContent-ID: 9\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1020-701e-00d7-4160-b47a511e9c84\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 43d352af-bf74-4324-a54d-94e146095c42\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3--", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "c50fdcab-40bb-4da4-815d-2b4ff8ec5327", + "Content-Type" : "multipart/mixed; boundary=batchresponse_873df0ca-9725-4efb-8dde-55c7a827d2e3" }, "Exception" : null }, { @@ -267,8 +267,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbulkdeleteblobs&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "043bd7f3-3cd9-4fbe-88e1-4582d31e142f" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "83e7f1a2-a692-40c0-8e11-69999b444b17" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -276,20 +276,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4bdf-d01e-007b-107a-845bc6000000", - "Body" : "jtcbulkdeleteblobsjtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959daWed, 16 Oct 2019 23:38:09 GMT\"0x8D75291E6EADE95\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "043bd7f3-3cd9-4fbe-88e1-4582d31e142f", + "x-ms-request-id" : "8dbb1037-701e-00d7-5860-b47a51000000", + "Body" : "jtcbulkdeleteblobsjtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107Mon, 16 Dec 2019 22:30:12 GMT\"0x8D7827784551026\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "83e7f1a2-a692-40c0-8e11-69999b444b17", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "59fc3998-ae83-4ca1-8224-a7237ab7d125" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5c2fb6f1-7a43-42f5-a3a8-64b2d38eab35" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -297,11 +297,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35938-201e-006e-387a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "59fc3998-ae83-4ca1-8224-a7237ab7d125" + "x-ms-request-id" : "8dbb1048-701e-00d7-6760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "5c2fb6f1-7a43-42f5-a3a8-64b2d38eab35" }, "Exception" : null } ], - "variables" : [ "jtcbulkdeleteblobs0batchapitestbulkdeleteblobs9fd8824959da", "javablobbulkdeleteblobs1batchapitestbulkdeleteblobs9fd48471dc", "javablobbulkdeleteblobs2batchapitestbulkdeleteblobs9fd9280665", "javablobbulkdeleteblobs3batchapitestbulkdeleteblobs9fd3395172", "javablobbulkdeleteblobs4batchapitestbulkdeleteblobs9fd7051837", "javablobbulkdeleteblobs5batchapitestbulkdeleteblobs9fd79821de", "javablobbulkdeleteblobs6batchapitestbulkdeleteblobs9fd20411a5", "javablobbulkdeleteblobs7batchapitestbulkdeleteblobs9fd399391c", "javablobbulkdeleteblobs8batchapitestbulkdeleteblobs9fd9842712", "javablobbulkdeleteblobs9batchapitestbulkdeleteblobs9fd16219c9", "javablobbulkdeleteblobs10batchapitestbulkdeleteblobs9fd13870e" ] + "variables" : [ "jtcbulkdeleteblobs0batchapitestbulkdeleteblobsb95899938107", "javablobbulkdeleteblobs1batchapitestbulkdeleteblobsb9583196ee", "javablobbulkdeleteblobs2batchapitestbulkdeleteblobsb955043749", "javablobbulkdeleteblobs3batchapitestbulkdeleteblobsb954883121", "javablobbulkdeleteblobs4batchapitestbulkdeleteblobsb950398700", "javablobbulkdeleteblobs5batchapitestbulkdeleteblobsb95907306e", "javablobbulkdeleteblobs6batchapitestbulkdeleteblobsb950154647", "javablobbulkdeleteblobs7batchapitestbulkdeleteblobsb95422171b", "javablobbulkdeleteblobs8batchapitestbulkdeleteblobsb958499677", "javablobbulkdeleteblobs9batchapitestbulkdeleteblobsb95646460b", "javablobbulkdeleteblobs10batchapitestbulkdeleteblobsb95141523" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulksetaccesstier.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulksetaccesstier.json index 1a8ab9ba2b29..72a753b74a10 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulksetaccesstier.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestbulksetaccesstier.json @@ -1,273 +1,273 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "5af0f666-56f6-4638-8774-f31d4cdf7aaf" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6964c06d-feb0-46aa-a0ba-403b499dd651" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E74C024C", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "ETag" : "0x8D7827784AE902A", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4bfb-d01e-007b-277a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "5af0f666-56f6-4638-8774-f31d4cdf7aaf" + "x-ms-request-id" : "8dbb105f-701e-00d7-7d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", + "x-ms-client-request-id" : "6964c06d-feb0-46aa-a0ba-403b499dd651" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier149311fc70da810cd245bd", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier16250152c62dc8dfeb475d", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "ea52ef27-d989-4d25-ad69-5f7a4014839f", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bf793c62-7799-4710-9607-8dc86d7a3ef6", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E75277D7", + "ETag" : "0x8D7827784B419FB", "Content-Length" : "0", - "x-ms-request-id" : "92e3596d-201e-006e-5e7a-84995f000000", - "x-ms-client-request-id" : "ea52ef27-d989-4d25-ad69-5f7a4014839f" + "x-ms-request-id" : "8dbb107a-701e-00d7-1560-b47a51000000", + "x-ms-client-request-id" : "bf793c62-7799-4710-9607-8dc86d7a3ef6" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier234524257b6eb284884372", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier2609871c3355dd96c8408e", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "5cab7a3b-a57f-4a44-af1c-2eb1e4c236f1", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "38c9512c-dbe1-44fd-a366-51b47ed0805d", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E75893CE", + "ETag" : "0x8D7827784C29C72", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4c22-d01e-007b-427a-845bc6000000", - "x-ms-client-request-id" : "5cab7a3b-a57f-4a44-af1c-2eb1e4c236f1" + "x-ms-request-id" : "8dbb1090-701e-00d7-2b60-b47a51000000", + "x-ms-client-request-id" : "38c9512c-dbe1-44fd-a366-51b47ed0805d" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier389174b4df6ff179264223", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier333300c48f6d86b40c4931", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b656f87f-10e3-4679-b742-026250f9b661", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "906c1ddf-209c-4c44-8d6a-dc5e51c5e7ae", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E75EAFCD", + "ETag" : "0x8D7827784C7CDDC", "Content-Length" : "0", - "x-ms-request-id" : "92e35984-201e-006e-707a-84995f000000", - "x-ms-client-request-id" : "b656f87f-10e3-4679-b742-026250f9b661" + "x-ms-request-id" : "8dbb10c5-701e-00d7-5d60-b47a51000000", + "x-ms-client-request-id" : "906c1ddf-209c-4c44-8d6a-dc5e51c5e7ae" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier4890431f387b8e0b5e46c4", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier4506222cb022ca2bde44d2", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b202bc1d-197b-48a8-8259-fd30cffe454a", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "89713e4e-034a-4c49-9454-ff01522eff86", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E764CBCA", + "ETag" : "0x8D7827784CD2655", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4c35-d01e-007b-547a-845bc6000000", - "x-ms-client-request-id" : "b202bc1d-197b-48a8-8259-fd30cffe454a" + "x-ms-request-id" : "8dbb10d5-701e-00d7-6d60-b47a51000000", + "x-ms-client-request-id" : "89713e4e-034a-4c49-9454-ff01522eff86" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier587408fb08802d0e884b22", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier5877211dca391d95274fb7", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2acffaa1-d43e-427f-8adb-714993372219", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "61caeb9f-1c5b-4eb9-988a-ca042ad6bc35", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E76BF96D", + "ETag" : "0x8D7827784D4F082", "Content-Length" : "0", - "x-ms-request-id" : "92e359a9-201e-006e-097a-84995f000000", - "x-ms-client-request-id" : "2acffaa1-d43e-427f-8adb-714993372219" + "x-ms-request-id" : "8dbb10ef-701e-00d7-0360-b47a51000000", + "x-ms-client-request-id" : "61caeb9f-1c5b-4eb9-988a-ca042ad6bc35" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier629720aaf48d9346fb489a", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier6365934cc1b6104a534166", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "5422b491-4637-4d30-9d24-3c413bfc1d08", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5173ef33-5d19-4052-a133-b07f2ab7722a", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E7728AB5", + "ETag" : "0x8D7827784D9FABE", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4c4c-d01e-007b-697a-845bc6000000", - "x-ms-client-request-id" : "5422b491-4637-4d30-9d24-3c413bfc1d08" + "x-ms-request-id" : "8dbb1103-701e-00d7-1560-b47a51000000", + "x-ms-client-request-id" : "5173ef33-5d19-4052-a133-b07f2ab7722a" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier71525325022103268a4f1a", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier772428fdf07eb2588b409b", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2de91ce2-2979-4898-b89a-7051430e7daa", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "04dc546d-c6b2-42a8-8bfb-0ebb389ceecc", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E77C02D8", + "ETag" : "0x8D7827784DF050C", "Content-Length" : "0", - "x-ms-request-id" : "92e359ce-201e-006e-237a-84995f000000", - "x-ms-client-request-id" : "2de91ce2-2979-4898-b89a-7051430e7daa" + "x-ms-request-id" : "8dbb1125-701e-00d7-3360-b47a51000000", + "x-ms-client-request-id" : "04dc546d-c6b2-42a8-8bfb-0ebb389ceecc" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier841267407556b84245414a", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier8808406db792c292624688", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "11d29277-c4c1-4629-8c7a-84dd31d17b98", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e8e011d2-bbf5-49a0-b609-e941466bfbfc", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:12 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E781F7B9", + "ETag" : "0x8D7827784E43669", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4c71-d01e-007b-077a-845bc6000000", - "x-ms-client-request-id" : "11d29277-c4c1-4629-8c7a-84dd31d17b98" + "x-ms-request-id" : "8dbb113a-701e-00d7-4760-b47a51000000", + "x-ms-client-request-id" : "e8e011d2-bbf5-49a0-b609-e941466bfbfc" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier965560bf6a9e53982c4d46", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier9650962c4f413f6ada43fa", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "94a19daa-030f-41a1-9fd8-af62ffd4ba81", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "74c32a2f-c5d1-415f-92f8-c6cd11fe44a5", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E78D9340", + "ETag" : "0x8D7827784E940B7", "Content-Length" : "0", - "x-ms-request-id" : "92e359e3-201e-006e-337a-84995f000000", - "x-ms-client-request-id" : "94a19daa-030f-41a1-9fd8-af62ffd4ba81" + "x-ms-request-id" : "8dbb114c-701e-00d7-5860-b47a51000000", + "x-ms-client-request-id" : "74c32a2f-c5d1-415f-92f8-c6cd11fe44a5" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec/javablobbulksetaccesstier108585669a990e18d4c4f5", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f/javablobbulksetaccesstier1060046a3efd0115108473", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "8fc9e97b-28af-48df-81de-c1dba946e46f", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a8ac2724-20b1-4727-a259-fa2bc93bd67e", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:10 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:13 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E7938822", + "ETag" : "0x8D7827784EE4B01", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4c92-d01e-007b-227a-845bc6000000", - "x-ms-client-request-id" : "8fc9e97b-28af-48df-81de-c1dba946e46f" + "x-ms-request-id" : "8dbb115a-701e-00d7-6360-b47a51000000", + "x-ms-client-request-id" : "a8ac2724-20b1-4727-a259-fa2bc93bd67e" }, "Exception" : null }, { @@ -275,9 +275,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "d3484fee-601c-4556-aca4-5d0981fcdb1a", - "Content-Type" : "multipart/mixed; boundary=batch_bfb13207-09f8-47d1-9ee4-7e83528ed81d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "25478a23-6416-4e9d-a61e-069db2424128", + "Content-Type" : "multipart/mixed; boundary=batch_a076c387-82e0-4742-a37f-1d1a4d3e3f5d" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -285,11 +285,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35a0b-201e-006e-517a-84995f000000", - "Body" : "--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c4b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 3a6a4852-deb2-4d32-b301-4c51fa29844c\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c4d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 8cd337cd-3a94-4e34-9c02-cd8b760faf78\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 2\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c4e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 38d34d10-1628-4a71-b673-37f375654600\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 3\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c4f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 851749d3-dac4-4633-afaa-89f66f353eef\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 4\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c50\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 857b6df2-1833-40f4-9ed4-97d0cff2a26a\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 5\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c51\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: d3a545fe-7e28-419f-b97a-048e9df99061\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 6\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c52\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 6af4b974-a60c-4dbd-8450-905af63147c6\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 7\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c53\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2d396ed3-6b35-4fd1-a4f5-070e8013bd94\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 8\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c54\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2ee8de27-136b-4500-b85a-a9ca363d8c1e\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887\r\nContent-Type: application/http\r\nContent-ID: 9\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e35a0b-201e-006e-517a-84995f1e4c55\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 0d4ac8f2-953f-478d-96de-c80fe0296f8f\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887--", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "d3484fee-601c-4556-aca4-5d0981fcdb1a", - "Content-Type" : "multipart/mixed; boundary=batchresponse_7095c348-6e48-4145-8b0c-e1c0e6369887" + "x-ms-request-id" : "8dbb116e-701e-00d7-7660-b47a51000000", + "Body" : "--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c96\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: a074cc10-85d3-4821-8aa5-f9aa7629a158\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c98\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 06d63296-06bc-458f-9bdb-83b755d38a89\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 2\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c99\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: d0ce7064-eecc-46e2-8421-00ede4ebf474\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 3\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c9a\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 99521934-dba7-4386-bc33-3ef1076f55d5\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 4\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c9b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: f428e581-1a62-4cb8-ab70-aa39ac015281\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 5\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c9c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 1f9b8b61-04b3-48e1-b3ac-60666cd56221\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 6\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c9d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 92b3b7aa-675b-432a-8806-82747a41c694\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 7\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c9e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c4ce734e-d91d-45b7-a0ed-2588985fdceb\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 8\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9c9f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c2171822-35a6-4bb2-95a1-94d61bc00def\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2\r\nContent-Type: application/http\r\nContent-ID: 9\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb116e-701e-00d7-7660-b47a511e9ca0\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 027f485a-c03c-4806-aaef-2f6c4d93eff2\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_afeded8c-c003-462d-9711-af0999fce0d2--", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "25478a23-6416-4e9d-a61e-069db2424128", + "Content-Type" : "multipart/mixed; boundary=batchresponse_afeded8c-c003-462d-9711-af0999fce0d2" }, "Exception" : null }, { @@ -297,8 +297,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbulksetaccesstier&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "3d52d1cd-6c15-4f0a-90bc-8edf7d6c5dc0" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "cc3ef4a8-c3b6-4ed7-ac61-b72c41c25be4" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -306,20 +306,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4cb9-d01e-007b-3c7a-845bc6000000", - "Body" : "jtcbulksetaccesstierjtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ecWed, 16 Oct 2019 23:38:10 GMT\"0x8D75291E74C024C\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "3d52d1cd-6c15-4f0a-90bc-8edf7d6c5dc0", + "x-ms-request-id" : "8dbb1184-701e-00d7-0960-b47a51000000", + "Body" : "jtcbulksetaccesstierjtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577fMon, 16 Dec 2019 22:30:13 GMT\"0x8D7827784AE902A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "cc3ef4a8-c3b6-4ed7-ac61-b72c41c25be4", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "a1137ed5-e37f-41f0-bf78-d98e76fc58e2" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e62d7b27-33cb-4e3d-be4b-f631c4946549" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -327,11 +327,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35a2d-201e-006e-687a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:09 GMT", - "x-ms-client-request-id" : "a1137ed5-e37f-41f0-bf78-d98e76fc58e2" + "x-ms-request-id" : "8dbb119d-701e-00d7-1e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "e62d7b27-33cb-4e3d-be4b-f631c4946549" }, "Exception" : null } ], - "variables" : [ "jtcbulksetaccesstier0batchapitestbulksetaccesstiere1670439ec", "javablobbulksetaccesstier149311fc70da810cd245bd", "javablobbulksetaccesstier234524257b6eb284884372", "javablobbulksetaccesstier389174b4df6ff179264223", "javablobbulksetaccesstier4890431f387b8e0b5e46c4", "javablobbulksetaccesstier587408fb08802d0e884b22", "javablobbulksetaccesstier629720aaf48d9346fb489a", "javablobbulksetaccesstier71525325022103268a4f1a", "javablobbulksetaccesstier841267407556b84245414a", "javablobbulksetaccesstier965560bf6a9e53982c4d46", "javablobbulksetaccesstier108585669a990e18d4c4f5" ] + "variables" : [ "jtcbulksetaccesstier0batchapitestbulksetaccesstier0e0026577f", "javablobbulksetaccesstier16250152c62dc8dfeb475d", "javablobbulksetaccesstier2609871c3355dd96c8408e", "javablobbulksetaccesstier333300c48f6d86b40c4931", "javablobbulksetaccesstier4506222cb022ca2bde44d2", "javablobbulksetaccesstier5877211dca391d95274fb7", "javablobbulksetaccesstier6365934cc1b6104a534166", "javablobbulksetaccesstier772428fdf07eb2588b409b", "javablobbulksetaccesstier8808406db792c292624688", "javablobbulksetaccesstier9650962c4f413f6ada43fa", "javablobbulksetaccesstier1060046a3efd0115108473" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeletebloballsucceed.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeletebloballsucceed.json index 9a7e19f97bb5..c41a22370740 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeletebloballsucceed.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeletebloballsucceed.json @@ -1,88 +1,88 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed013823abf2e360c66847199?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed0227632217a00ce28645aba?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "e6fdc742-0c98-4d54-9454-ade434670330" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6c141923-27e5-40d8-a53e-4fc614fddacb" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5DD2C6F", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D78277836211AA", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e354e6-201e-006e-797a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "e6fdc742-0c98-4d54-9454-ade434670330" + "x-ms-request-id" : "8dbb097f-701e-00d7-2c60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "6c141923-27e5-40d8-a53e-4fc614fddacb" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed150736010152f08782415aa?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed1085774668c8c02e854d30b?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "bf5e9d86-a6b9-4b42-9060-05ca73f81eea" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "70297664-696d-4601-a007-ed2b6a329abd" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5E53BE6", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D7827783674307", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4859-d01e-007b-047a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "bf5e9d86-a6b9-4b42-9060-05ca73f81eea" + "x-ms-request-id" : "8dbb099e-701e-00d7-4660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "70297664-696d-4601-a007-ed2b6a329abd" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed150736010152f08782415aa/javablobdeletebloballsucceed23783925d2c1416f174a", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed1085774668c8c02e854d30b/javablobdeletebloballsucceed209311db2073f17b7749", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "d5ca4be4-9c9b-41aa-aa14-5f0ab8ec1a8a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "949762b7-103b-4f31-a1de-64726c8a0f99" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5ECC511", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D78277836FD892", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e35514-201e-006e-207a-84995f000000", + "x-ms-request-id" : "8dbb09c5-701e-00d7-6960-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "d5ca4be4-9c9b-41aa-aa14-5f0ab8ec1a8a" + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "949762b7-103b-4f31-a1de-64726c8a0f99" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed150736010152f08782415aa/javablobdeletebloballsucceed35999600327abff2434d", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed1085774668c8c02e854d30b/javablobdeletebloballsucceed32053036efe34c5d974b", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "42374d19-d354-4a8c-9b22-007718d9522b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "88679a5f-6904-49ed-bf21-0018b2bf1e0e" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5F30821", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D782778375CD76", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4874-d01e-007b-1d7a-845bc6000000", + "x-ms-request-id" : "8dbb09e7-701e-00d7-0a60-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "42374d19-d354-4a8c-9b22-007718d9522b" + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "88679a5f-6904-49ed-bf21-0018b2bf1e0e" }, "Exception" : null }, { @@ -90,9 +90,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c577a0a9-d987-4ff6-90e7-c818d235755c", - "Content-Type" : "multipart/mixed; boundary=batch_8bc661ce-24a5-4f3f-9a18-5b0b8d4fad27" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f6b222c6-4c32-4efe-81a2-916ba8c9cb36", + "Content-Type" : "multipart/mixed; boundary=batch_1716bf88-d909-4d07-8b25-5e04be7c4975" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -100,11 +100,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35546-201e-006e-497a-84995f000000", - "Body" : "--batchresponse_8d279bf5-b324-4c67-ab71-2f5a5d67d3aa\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35546-201e-006e-497a-84995f1e4bce\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: df36235d-7fde-4c00-83f8-eb4b457d367a\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_8d279bf5-b324-4c67-ab71-2f5a5d67d3aa\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35546-201e-006e-497a-84995f1e4bd0\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 735fe533-2f56-4f0b-a376-d0a8fcace549\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_8d279bf5-b324-4c67-ab71-2f5a5d67d3aa--", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "c577a0a9-d987-4ff6-90e7-c818d235755c", - "Content-Type" : "multipart/mixed; boundary=batchresponse_8d279bf5-b324-4c67-ab71-2f5a5d67d3aa" + "x-ms-request-id" : "8dbb0a04-701e-00d7-2360-b47a51000000", + "Body" : "--batchresponse_6f91725d-ff09-4be2-ab80-06a2a7e1a24e\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb0a04-701e-00d7-2360-b47a511e9c26\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 48509665-db50-4687-b895-b8ee084d982a\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_6f91725d-ff09-4be2-ab80-06a2a7e1a24e\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb0a04-701e-00d7-2360-b47a511e9c2a\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 92b0e408-4e45-46ce-86f2-8e2d04e09cc0\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_6f91725d-ff09-4be2-ab80-06a2a7e1a24e--", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "f6b222c6-4c32-4efe-81a2-916ba8c9cb36", + "Content-Type" : "multipart/mixed; boundary=batchresponse_6f91725d-ff09-4be2-ab80-06a2a7e1a24e" }, "Exception" : null }, { @@ -112,8 +112,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeletebloballsucceed&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2d22b9a2-0830-46e5-9bfb-d5371419e6fb" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5b7d2607-a506-4717-9043-1daa3d590791" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -121,20 +121,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed489a-d01e-007b-3d7a-845bc6000000", - "Body" : "jtcdeletebloballsucceedjtcdeletebloballsucceed013823abf2e360c66847199Wed, 16 Oct 2019 23:38:07 GMT\"0x8D75291E5DD2C6F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeletebloballsucceed150736010152f08782415aaWed, 16 Oct 2019 23:38:07 GMT\"0x8D75291E5E53BE6\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "2d22b9a2-0830-46e5-9bfb-d5371419e6fb", + "x-ms-request-id" : "8dbb0a49-701e-00d7-5f60-b47a51000000", + "Body" : "jtcdeletebloballsucceedjtcdeletebloballsucceed0227632217a00ce28645abaMon, 16 Dec 2019 22:30:11 GMT\"0x8D78277836211AA\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeletebloballsucceed1085774668c8c02e854d30bMon, 16 Dec 2019 22:30:11 GMT\"0x8D7827783674307\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "5b7d2607-a506-4717-9043-1daa3d590791", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed013823abf2e360c66847199?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed0227632217a00ce28645aba?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "3eebbf37-03ca-4bb2-8bae-aef4b81d1da1" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9de546b5-aba4-4f75-ba82-ec28c99d725d" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -142,18 +142,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e3557f-201e-006e-7f7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "3eebbf37-03ca-4bb2-8bae-aef4b81d1da1" + "x-ms-request-id" : "8dbb0a65-701e-00d7-7760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "9de546b5-aba4-4f75-ba82-ec28c99d725d" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed150736010152f08782415aa?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletebloballsucceed1085774668c8c02e854d30b?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "3cf34b43-b312-4945-a76d-1ed838b3d4ee" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "004a6d47-0ad4-4df4-b69d-b844f38a4b2b" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -161,11 +161,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed48be-d01e-007b-5d7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "3cf34b43-b312-4945-a76d-1ed838b3d4ee" + "x-ms-request-id" : "8dbb0a7c-701e-00d7-0c60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "004a6d47-0ad4-4df4-b69d-b844f38a4b2b" }, "Exception" : null } ], - "variables" : [ "jtcdeletebloballsucceed013823abf2e360c66847199", "jtcdeletebloballsucceed150736010152f08782415aa", "javablobdeletebloballsucceed23783925d2c1416f174a", "javablobdeletebloballsucceed35999600327abff2434d" ] + "variables" : [ "jtcdeletebloballsucceed0227632217a00ce28645aba", "jtcdeletebloballsucceed1085774668c8c02e854d30b", "javablobdeletebloballsucceed209311db2073f17b7749", "javablobdeletebloballsucceed32053036efe34c5d974b" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceeddonotthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceeddonotthrowonanyerror.json index 11272230479c..86037ab847a3 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceeddonotthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceeddonotthrowonanyerror.json @@ -1,44 +1,44 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror0782744daa5b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror003260a2133f?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c3b4ffce-08b1-476f-8639-824d4f44896e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "489af726-7613-4ef8-8543-ea4753887617" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6B34DA2", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D78277841F262D", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e357d6-201e-006e-2c7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "c3b4ffce-08b1-476f-8639-824d4f44896e" + "x-ms-request-id" : "8dbb0d97-701e-00d7-6160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "489af726-7613-4ef8-8543-ea4753887617" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror148915027b5f?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror171656dbe017?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "8a9952ba-e857-4969-a1a9-911fa59fb594" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "744ced53-5f82-46ed-98c3-daaa6b7b2800" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6B96227", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:09 GMT", + "ETag" : "0x8D782778424578B", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4a86-d01e-007b-1b7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "8a9952ba-e857-4969-a1a9-911fa59fb594" + "x-ms-request-id" : "8dbb0dbd-701e-00d7-0360-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "744ced53-5f82-46ed-98c3-daaa6b7b2800" }, "Exception" : null }, { @@ -46,9 +46,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "9d82298a-7b24-431f-b904-75344d7f4058", - "Content-Type" : "multipart/mixed; boundary=batch_c8117c20-c104-4fc3-9c79-7a263b9647e2" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2a4f5ca2-e30c-44b4-b562-c664d363369a", + "Content-Type" : "multipart/mixed; boundary=batch_0253fb30-2c54-41e5-b696-79bc3f9dc41b" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -56,11 +56,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35801-201e-006e-497a-84995f000000", - "Body" : "--batchresponse_57ffa18e-34df-4faf-bf9a-a5583aeadac3\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35801-201e-006e-497a-84995f1e4c0c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 618072f7-ac71-489f-a60a-9a85ca7ea24f\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35801-201e-006e-497a-84995f1e4c0c\nTime:2019-10-16T23:38:09.1321388Z\r\n--batchresponse_57ffa18e-34df-4faf-bf9a-a5583aeadac3\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35801-201e-006e-497a-84995f1e4c0e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 9b0d4113-ec72-4f68-9eb5-4800485e73ab\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35801-201e-006e-497a-84995f1e4c0e\nTime:2019-10-16T23:38:09.1311376Z\r\n--batchresponse_57ffa18e-34df-4faf-bf9a-a5583aeadac3--", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "9d82298a-7b24-431f-b904-75344d7f4058", - "Content-Type" : "multipart/mixed; boundary=batchresponse_57ffa18e-34df-4faf-bf9a-a5583aeadac3" + "x-ms-request-id" : "8dbb0dd6-701e-00d7-1b60-b47a51000000", + "Body" : "--batchresponse_4f525754-b2bc-4405-90a8-54f1ae406f7b\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0dd6-701e-00d7-1b60-b47a511e9c5a\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 633b3c5c-7f8e-4d13-a38b-b7b737ef701c\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0dd6-701e-00d7-1b60-b47a511e9c5a\nTime:2019-12-16T22:30:12.6268187Z\r\n--batchresponse_4f525754-b2bc-4405-90a8-54f1ae406f7b\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0dd6-701e-00d7-1b60-b47a511e9c5c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 66ddc757-accf-4844-a3d7-18b84f909266\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0dd6-701e-00d7-1b60-b47a511e9c5c\nTime:2019-12-16T22:30:12.6278199Z\r\n--batchresponse_4f525754-b2bc-4405-90a8-54f1ae406f7b--", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "2a4f5ca2-e30c-44b4-b562-c664d363369a", + "Content-Type" : "multipart/mixed; boundary=batchresponse_4f525754-b2bc-4405-90a8-54f1ae406f7b" }, "Exception" : null }, { @@ -68,8 +68,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteblobnonesucceeddonotthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b1aeb44d-08e4-416b-aa64-7819ee6086cb" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ec45f497-3648-4b10-bc35-e0732487bcbe" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -77,20 +77,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4aba-d01e-007b-3b7a-845bc6000000", - "Body" : "jtcdeleteblobnonesucceeddonotthrowonanyerrorjtcdeleteblobnonesucceeddonotthrowonanyerror0782744daa5bWed, 16 Oct 2019 23:38:09 GMT\"0x8D75291E6B34DA2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobnonesucceeddonotthrowonanyerror148915027b5fWed, 16 Oct 2019 23:38:09 GMT\"0x8D75291E6B96227\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "b1aeb44d-08e4-416b-aa64-7819ee6086cb", + "x-ms-request-id" : "8dbb0df6-701e-00d7-3860-b47a51000000", + "Body" : "jtcdeleteblobnonesucceeddonotthrowonanyerrorjtcdeleteblobnonesucceeddonotthrowonanyerror003260a2133fMon, 16 Dec 2019 22:30:12 GMT\"0x8D78277841F262D\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobnonesucceeddonotthrowonanyerror171656dbe017Mon, 16 Dec 2019 22:30:12 GMT\"0x8D782778424578B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "ec45f497-3648-4b10-bc35-e0732487bcbe", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror0782744daa5b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror003260a2133f?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b991a3ee-d485-4c0d-8d9c-5823266a8f88" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "68031c99-4744-48bf-8579-e36abaa855d3" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -98,18 +98,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35825-201e-006e-607a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "b991a3ee-d485-4c0d-8d9c-5823266a8f88" + "x-ms-request-id" : "8dbb0e0c-701e-00d7-4d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "68031c99-4744-48bf-8579-e36abaa855d3" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror148915027b5f?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceeddonotthrowonanyerror171656dbe017?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "21e610c9-a73c-4a4a-bc62-8e5b3fb76518" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3ec6ceb6-6d21-4cbc-b5da-76f3fb1faa85" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -117,11 +117,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4ad9-d01e-007b-527a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "21e610c9-a73c-4a4a-bc62-8e5b3fb76518" + "x-ms-request-id" : "8dbb0e26-701e-00d7-6660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "3ec6ceb6-6d21-4cbc-b5da-76f3fb1faa85" }, "Exception" : null } ], - "variables" : [ "jtcdeleteblobnonesucceeddonotthrowonanyerror0782744daa5b", "jtcdeleteblobnonesucceeddonotthrowonanyerror148915027b5f", "javablobdeleteblobnonesucceeddonotthrowonanyerror2555174c2e", "javablobdeleteblobnonesucceeddonotthrowonanyerror3906681aa9" ] + "variables" : [ "jtcdeleteblobnonesucceeddonotthrowonanyerror003260a2133f", "jtcdeleteblobnonesucceeddonotthrowonanyerror171656dbe017", "javablobdeleteblobnonesucceeddonotthrowonanyerror205369e99f", "javablobdeleteblobnonesucceeddonotthrowonanyerror3993453cfd" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceedthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceedthrowonanyerror.json index aa09f449a375..cdd79957a59d 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceedthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobnonesucceedthrowonanyerror.json @@ -1,44 +1,44 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror001530fd1fe8ebd?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror064094debfdeb01?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "2e189481-89a8-4bf2-a139-a0dcbe8bb0de" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "07fcdd93-88b9-464c-8897-a679d2e17985" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E68F422E", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783FACCA7", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e35769-201e-006e-5f7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "2e189481-89a8-4bf2-a139-a0dcbe8bb0de" + "x-ms-request-id" : "8dbb0cc5-701e-00d7-2060-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "07fcdd93-88b9-464c-8897-a679d2e17985" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror12480995ae82de8?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror12745654f520b3d?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "0b220c49-8080-4c12-8376-0011d40ef9d8" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9899ab4b-6517-43bf-a794-d08a4f87116f" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E695CBBD", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783FFFE05", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4a29-d01e-007b-547a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "0b220c49-8080-4c12-8376-0011d40ef9d8" + "x-ms-request-id" : "8dbb0ced-701e-00d7-4460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "9899ab4b-6517-43bf-a794-d08a4f87116f" }, "Exception" : null }, { @@ -46,9 +46,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "1da19afa-b7ad-4bb6-8063-1fcf8199c5aa", - "Content-Type" : "multipart/mixed; boundary=batch_d382ba35-8ef1-402a-97b6-81e34bb9ba3e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f3c7d874-f5c0-40cb-88d9-eb5c154ff72e", + "Content-Type" : "multipart/mixed; boundary=batch_ab7f3087-78bc-48be-ab80-a651e09a9895" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -56,11 +56,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35795-201e-006e-807a-84995f000000", - "Body" : "--batchresponse_d03f0d04-579e-4bbb-a26d-801f938c5d82\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35795-201e-006e-807a-84995f1e4bff\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 689fb401-abc1-4975-9e50-2939f5eb2243\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35795-201e-006e-807a-84995f1e4bff\nTime:2019-10-16T23:38:08.8999202Z\r\n--batchresponse_d03f0d04-579e-4bbb-a26d-801f938c5d82\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35795-201e-006e-807a-84995f1e4c01\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 7236122b-a277-48f8-828d-9f3262f43b40\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35795-201e-006e-807a-84995f1e4c01\nTime:2019-10-16T23:38:08.8999202Z\r\n--batchresponse_d03f0d04-579e-4bbb-a26d-801f938c5d82--", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "1da19afa-b7ad-4bb6-8063-1fcf8199c5aa", - "Content-Type" : "multipart/mixed; boundary=batchresponse_d03f0d04-579e-4bbb-a26d-801f938c5d82" + "x-ms-request-id" : "8dbb0d0e-701e-00d7-6360-b47a51000000", + "Body" : "--batchresponse_9f72520e-37a7-4130-acbd-377d65a53c47\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0d0e-701e-00d7-6360-b47a511e9c53\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: a186d40c-6080-413f-b404-034efbe8d696\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0d0e-701e-00d7-6360-b47a511e9c53\nTime:2019-12-16T22:30:12.3926010Z\r\n--batchresponse_9f72520e-37a7-4130-acbd-377d65a53c47\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0d0e-701e-00d7-6360-b47a511e9c55\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 3f0c9200-372b-4a99-ae27-b2194dd23c69\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0d0e-701e-00d7-6360-b47a511e9c55\nTime:2019-12-16T22:30:12.3926010Z\r\n--batchresponse_9f72520e-37a7-4130-acbd-377d65a53c47--", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "f3c7d874-f5c0-40cb-88d9-eb5c154ff72e", + "Content-Type" : "multipart/mixed; boundary=batchresponse_9f72520e-37a7-4130-acbd-377d65a53c47" }, "Exception" : null }, { @@ -68,8 +68,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteblobnonesucceedthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "bc9536f6-ccad-4d03-985b-6102418a15d2" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ddc90186-8294-4df5-820d-c648bf2ea6b9" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -77,20 +77,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4a47-d01e-007b-687a-845bc6000000", - "Body" : "jtcdeleteblobnonesucceedthrowonanyerrorjtcdeleteblobnonesucceedthrowonanyerror001530fd1fe8ebdWed, 16 Oct 2019 23:38:08 GMT\"0x8D75291E68F422E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobnonesucceedthrowonanyerror12480995ae82de8Wed, 16 Oct 2019 23:38:08 GMT\"0x8D75291E695CBBD\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "bc9536f6-ccad-4d03-985b-6102418a15d2", + "x-ms-request-id" : "8dbb0d2b-701e-00d7-7e60-b47a51000000", + "Body" : "jtcdeleteblobnonesucceedthrowonanyerrorjtcdeleteblobnonesucceedthrowonanyerror064094debfdeb01Mon, 16 Dec 2019 22:30:12 GMT\"0x8D7827783FACCA7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobnonesucceedthrowonanyerror12745654f520b3dMon, 16 Dec 2019 22:30:12 GMT\"0x8D7827783FFFE05\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "ddc90186-8294-4df5-820d-c648bf2ea6b9", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror001530fd1fe8ebd?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror064094debfdeb01?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "45a5c66a-cc7a-4bb5-8476-95a81f909c96" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b8df8dd7-97ee-4dfb-9926-40931d665ce1" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -98,18 +98,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e357b5-201e-006e-167a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "45a5c66a-cc7a-4bb5-8476-95a81f909c96" + "x-ms-request-id" : "8dbb0d58-701e-00d7-2760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "b8df8dd7-97ee-4dfb-9926-40931d665ce1" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror12480995ae82de8?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobnonesucceedthrowonanyerror12745654f520b3d?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "fc54889b-b214-4cf2-a53d-212c8b0ef410" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c79cedaa-d380-4cfe-a92f-29b27acbc9b6" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -117,11 +117,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4a5f-d01e-007b-7e7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "fc54889b-b214-4cf2-a53d-212c8b0ef410" + "x-ms-request-id" : "8dbb0d7e-701e-00d7-4960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "c79cedaa-d380-4cfe-a92f-29b27acbc9b6" }, "Exception" : null } ], - "variables" : [ "jtcdeleteblobnonesucceedthrowonanyerror001530fd1fe8ebd", "jtcdeleteblobnonesucceedthrowonanyerror12480995ae82de8", "javablobdeleteblobnonesucceedthrowonanyerror22538078e239", "javablobdeleteblobnonesucceedthrowonanyerror337110794fd3" ] + "variables" : [ "jtcdeleteblobnonesucceedthrowonanyerror064094debfdeb01", "jtcdeleteblobnonesucceedthrowonanyerror12745654f520b3d", "javablobdeleteblobnonesucceedthrowonanyerror203716929583", "javablobdeleteblobnonesucceedthrowonanyerror346504904e5e" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceeddonotthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceeddonotthrowonanyerror.json index 9b7897b78802..e97be6a007d2 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceeddonotthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceeddonotthrowonanyerror.json @@ -1,66 +1,66 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror0564618f0738?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror062193d88180?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "45e70ee9-ac90-4cc8-bed9-bb52dc49f2be" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "78b9ff6c-bd8b-46ec-b59f-d5efa8a23cab" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E66512C8", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783CCFAF5", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4999-d01e-007b-717a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "45e70ee9-ac90-4cc8-bed9-bb52dc49f2be" + "x-ms-request-id" : "8dbb0b96-701e-00d7-0d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "78b9ff6c-bd8b-46ec-b59f-d5efa8a23cab" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror1386245a1187?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror139644d2a2ea?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "81238ac8-a010-495a-beb9-5badb9f4cfd1" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4e573ae9-b440-4ef6-a3c8-6e808df4dfea" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E66B0FA3", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783D27A80", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e356ee-201e-006e-077a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "81238ac8-a010-495a-beb9-5badb9f4cfd1" + "x-ms-request-id" : "8dbb0bc1-701e-00d7-3360-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "4e573ae9-b440-4ef6-a3c8-6e808df4dfea" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror1386245a1187/javablobdeleteblobsomesucceeddonotthrowonanyerror2516593903", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror139644d2a2ea/javablobdeleteblobsomesucceeddonotthrowonanyerror2070372fed", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "82cb94ea-65c2-4ba1-b59b-a76288e9791e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "da7274d7-cb6e-4a30-9980-779cfab1004b" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E671CC92", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783D850EB", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:12 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed49c1-d01e-007b-0c7a-845bc6000000", + "x-ms-request-id" : "8dbb0beb-701e-00d7-5860-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "82cb94ea-65c2-4ba1-b59b-a76288e9791e" + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "da7274d7-cb6e-4a30-9980-779cfab1004b" }, "Exception" : null }, { @@ -68,9 +68,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "29af7814-7cd8-495e-9c7b-1bf151461e2d", - "Content-Type" : "multipart/mixed; boundary=batch_1527798d-a929-4314-8558-26b8e4d538ee" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b56e28f8-d505-4709-b368-97c4620a5541", + "Content-Type" : "multipart/mixed; boundary=batch_cf9df209-4f84-49b0-a1ba-8bdfb6d68565" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -78,11 +78,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35719-201e-006e-267a-84995f000000", - "Body" : "--batchresponse_804e3309-68ba-420e-a38c-52547eab95c3\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 92e35719-201e-006e-267a-84995f1e4bf5\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: fb09a745-3b47-4326-82db-32c48927c9d2\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_804e3309-68ba-420e-a38c-52547eab95c3\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35719-201e-006e-267a-84995f1e4bf7\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: ef24c3cb-abc8-4ed2-aa9a-e5d88e1e0df0\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35719-201e-006e-267a-84995f1e4bf7\nTime:2019-10-16T23:38:08.6566911Z\r\n--batchresponse_804e3309-68ba-420e-a38c-52547eab95c3--", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "29af7814-7cd8-495e-9c7b-1bf151461e2d", - "Content-Type" : "multipart/mixed; boundary=batchresponse_804e3309-68ba-420e-a38c-52547eab95c3" + "x-ms-request-id" : "8dbb0c11-701e-00d7-7c60-b47a51000000", + "Body" : "--batchresponse_b8340a9e-40ba-44d9-8eca-625af354c654\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb0c11-701e-00d7-7c60-b47a511e9c47\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: f6f49e1b-1f6a-43ed-8a79-b4b789381d81\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_b8340a9e-40ba-44d9-8eca-625af354c654\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0c11-701e-00d7-7c60-b47a511e9c49\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 87de2a44-540d-4c6f-a4ba-c7cdf5853906\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0c11-701e-00d7-7c60-b47a511e9c49\nTime:2019-12-16T22:30:12.1303563Z\r\n--batchresponse_b8340a9e-40ba-44d9-8eca-625af354c654--", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "b56e28f8-d505-4709-b368-97c4620a5541", + "Content-Type" : "multipart/mixed; boundary=batchresponse_b8340a9e-40ba-44d9-8eca-625af354c654" }, "Exception" : null }, { @@ -90,8 +90,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteblobsomesucceeddonotthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "96811b41-9797-4ab2-a84b-40098db37de3" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c345b98a-28b8-46b3-92d4-7c85ef4ca795" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -99,20 +99,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed49e6-d01e-007b-237a-845bc6000000", - "Body" : "jtcdeleteblobsomesucceeddonotthrowonanyerrorjtcdeleteblobsomesucceeddonotthrowonanyerror0564618f0738Wed, 16 Oct 2019 23:38:08 GMT\"0x8D75291E66512C8\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobsomesucceeddonotthrowonanyerror1386245a1187Wed, 16 Oct 2019 23:38:08 GMT\"0x8D75291E66B0FA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "96811b41-9797-4ab2-a84b-40098db37de3", + "x-ms-request-id" : "8dbb0c36-701e-00d7-1c60-b47a51000000", + "Body" : "jtcdeleteblobsomesucceeddonotthrowonanyerrorjtcdeleteblobsomesucceeddonotthrowonanyerror062193d88180Mon, 16 Dec 2019 22:30:12 GMT\"0x8D7827783CCFAF5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobsomesucceeddonotthrowonanyerror139644d2a2eaMon, 16 Dec 2019 22:30:12 GMT\"0x8D7827783D27A80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "c345b98a-28b8-46b3-92d4-7c85ef4ca795", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror0564618f0738?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror062193d88180?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "58ae0c91-b93e-42ed-bd54-bee6fb727dcd" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "340408fc-5c1e-4ca8-a194-165fb9450601" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -120,18 +120,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35738-201e-006e-3e7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:08 GMT", - "x-ms-client-request-id" : "58ae0c91-b93e-42ed-bd54-bee6fb727dcd" + "x-ms-request-id" : "8dbb0c73-701e-00d7-5660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "340408fc-5c1e-4ca8-a194-165fb9450601" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror1386245a1187?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceeddonotthrowonanyerror139644d2a2ea?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "ffaa868c-8474-4eae-941f-fb48df053857" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a052c6e7-1ff7-406f-b307-a6feb8d80548" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -139,11 +139,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4a0d-d01e-007b-3d7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "ffaa868c-8474-4eae-941f-fb48df053857" + "x-ms-request-id" : "8dbb0c91-701e-00d7-7160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "a052c6e7-1ff7-406f-b307-a6feb8d80548" }, "Exception" : null } ], - "variables" : [ "jtcdeleteblobsomesucceeddonotthrowonanyerror0564618f0738", "jtcdeleteblobsomesucceeddonotthrowonanyerror1386245a1187", "javablobdeleteblobsomesucceeddonotthrowonanyerror2516593903", "javablobdeleteblobsomesucceeddonotthrowonanyerror336407a148" ] + "variables" : [ "jtcdeleteblobsomesucceeddonotthrowonanyerror062193d88180", "jtcdeleteblobsomesucceeddonotthrowonanyerror139644d2a2ea", "javablobdeleteblobsomesucceeddonotthrowonanyerror2070372fed", "javablobdeleteblobsomesucceeddonotthrowonanyerror3836949dc2" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceedthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceedthrowonanyerror.json index 7efc7601ddb9..74670fa755b3 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceedthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestdeleteblobsomesucceedthrowonanyerror.json @@ -1,66 +1,66 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror022410d2736d482?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror07738877c2256db?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b2192c5a-a3dc-401d-a9d3-ecbc9b5b8c5a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "600c7c72-4ac6-4402-9b2b-016f6f202627" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6144F3C", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D78277839C1B43", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e3559d-201e-006e-1b7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "b2192c5a-a3dc-401d-a9d3-ecbc9b5b8c5a" + "x-ms-request-id" : "8dbb0a9a-701e-00d7-2860-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "600c7c72-4ac6-4402-9b2b-016f6f202627" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror137277889a7a363?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror1107271c0c635e1?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "e4a875a6-4bfc-4d0d-881f-339ad99c33b2" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "478de0d8-2d7e-4a8c-9719-40c24d51bb03" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6211B32", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783A21026", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed48d7-d01e-007b-767a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "e4a875a6-4bfc-4d0d-881f-339ad99c33b2" + "x-ms-request-id" : "8dbb0abd-701e-00d7-4960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "478de0d8-2d7e-4a8c-9719-40c24d51bb03" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror137277889a7a363/javablobdeleteblobsomesucceedthrowonanyerror21427740a0de", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror1107271c0c635e1/javablobdeleteblobsomesucceedthrowonanyerror286219aa3f14", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c3a062e2-76a1-43a2-b2f9-a4488526ffea" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e5ea4f9e-d741-421a-8cb9-0183d742ade5" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E6287CE1", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:08 GMT", + "ETag" : "0x8D7827783B1ACA1", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e3560a-201e-006e-6a7a-84995f000000", + "x-ms-request-id" : "8dbb0b0c-701e-00d7-0a60-b47a51000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "c3a062e2-76a1-43a2-b2f9-a4488526ffea" + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "e5ea4f9e-d741-421a-8cb9-0183d742ade5" }, "Exception" : null }, { @@ -68,9 +68,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "054d316e-2ca7-40dd-b6f8-3b34f692e991", - "Content-Type" : "multipart/mixed; boundary=batch_fca8569a-f798-4e79-bbc9-08da23157fff" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b9f77978-2450-464d-8720-459c838fe2d1", + "Content-Type" : "multipart/mixed; boundary=batch_23be30bb-77b9-42ba-8687-bbf367fbd6bc" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -78,11 +78,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4912-d01e-007b-177a-845bc6000000", - "Body" : "--batchresponse_c951ab3a-9c96-41fe-b982-1dabc17d6185\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: a0ed4912-d01e-007b-177a-845bc61e10a2\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 4684deef-ad90-4d15-a579-eef756fe4328\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_c951ab3a-9c96-41fe-b982-1dabc17d6185\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: a0ed4912-d01e-007b-177a-845bc61e10a8\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 8717374e-b4ad-4fab-9e2b-333e932403ed\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:a0ed4912-d01e-007b-177a-845bc61e10a8\nTime:2019-10-16T23:38:08.3842268Z\r\n--batchresponse_c951ab3a-9c96-41fe-b982-1dabc17d6185--", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "054d316e-2ca7-40dd-b6f8-3b34f692e991", - "Content-Type" : "multipart/mixed; boundary=batchresponse_c951ab3a-9c96-41fe-b982-1dabc17d6185" + "x-ms-request-id" : "8dbb0b23-701e-00d7-1f60-b47a51000000", + "Body" : "--batchresponse_76b5e887-67bd-488f-822e-cb65a87f66a7\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb0b23-701e-00d7-1f60-b47a511e9c35\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: fdfea599-07bd-4b84-8e3f-921a63e26165\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_76b5e887-67bd-488f-822e-cb65a87f66a7\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0b23-701e-00d7-1f60-b47a511e9c37\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: f94ae0b2-95c5-4831-b4d3-6e7ffe9e4a8f\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0b23-701e-00d7-1f60-b47a511e9c37\nTime:2019-12-16T22:30:11.8751179Z\r\n--batchresponse_76b5e887-67bd-488f-822e-cb65a87f66a7--", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "b9f77978-2450-464d-8720-459c838fe2d1", + "Content-Type" : "multipart/mixed; boundary=batchresponse_76b5e887-67bd-488f-822e-cb65a87f66a7" }, "Exception" : null }, { @@ -90,8 +90,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteblobsomesucceedthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b151bd32-785b-491c-b8a5-531a87da339d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9157b697-c20f-4501-bba1-81f6dd3a673b" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -99,20 +99,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "92e356b3-201e-006e-617a-84995f000000", - "Body" : "jtcdeleteblobsomesucceedthrowonanyerrorjtcdeleteblobsomesucceedthrowonanyerror022410d2736d482Wed, 16 Oct 2019 23:38:08 GMT\"0x8D75291E6144F3C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobsomesucceedthrowonanyerror137277889a7a363Wed, 16 Oct 2019 23:38:08 GMT\"0x8D75291E6211B32\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "b151bd32-785b-491c-b8a5-531a87da339d", + "x-ms-request-id" : "8dbb0b42-701e-00d7-3d60-b47a51000000", + "Body" : "jtcdeleteblobsomesucceedthrowonanyerrorjtcdeleteblobsomesucceedthrowonanyerror07738877c2256dbMon, 16 Dec 2019 22:30:11 GMT\"0x8D78277839C1B43\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcdeleteblobsomesucceedthrowonanyerror1107271c0c635e1Mon, 16 Dec 2019 22:30:11 GMT\"0x8D7827783A21026\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "9157b697-c20f-4501-bba1-81f6dd3a673b", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror022410d2736d482?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror07738877c2256db?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "1e9bbcba-631a-4106-b103-38b6b0c122a4" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7a1f2414-0bf2-44a8-ab8b-77194a137314" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -120,18 +120,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4974-d01e-007b-577a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "1e9bbcba-631a-4106-b103-38b6b0c122a4" + "x-ms-request-id" : "8dbb0b57-701e-00d7-5160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "7a1f2414-0bf2-44a8-ab8b-77194a137314" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror137277889a7a363?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteblobsomesucceedthrowonanyerror1107271c0c635e1?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "02bcea0a-6134-401e-8f13-aad9b9ee895d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "af408a0a-8e71-47fd-add9-3cee528c3c4e" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -139,11 +139,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e356d4-201e-006e-767a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:07 GMT", - "x-ms-client-request-id" : "02bcea0a-6134-401e-8f13-aad9b9ee895d" + "x-ms-request-id" : "8dbb0b72-701e-00d7-6b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:11 GMT", + "x-ms-client-request-id" : "af408a0a-8e71-47fd-add9-3cee528c3c4e" }, "Exception" : null } ], - "variables" : [ "jtcdeleteblobsomesucceedthrowonanyerror022410d2736d482", "jtcdeleteblobsomesucceedthrowonanyerror137277889a7a363", "javablobdeleteblobsomesucceedthrowonanyerror21427740a0de", "javablobdeleteblobsomesucceedthrowonanyerror380207e3b5f7" ] + "variables" : [ "jtcdeleteblobsomesucceedthrowonanyerror07738877c2256db", "jtcdeleteblobsomesucceedthrowonanyerror1107271c0c635e1", "javablobdeleteblobsomesucceedthrowonanyerror286219aa3f14", "javablobdeleteblobsomesucceedthrowonanyerror318628d52bcb" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestemptybatch.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestemptybatch.json index b6e8a695fac8..933fe6f23bcb 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestemptybatch.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestemptybatch.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcemptybatch0batchapitestemptybatche0b11844e22165d3a?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcemptybatch0batchapitestemptybatchddf82741f4ff86e19?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "76d44622-bcfc-4df4-a7a9-07786b242475" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fac4408f-2c9d-42d2-982b-029b57564c01" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E4111982", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:04 GMT", + "ETag" : "0x8D7827781D630E9", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:08 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4446-d01e-007b-0b7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:03 GMT", - "x-ms-client-request-id" : "76d44622-bcfc-4df4-a7a9-07786b242475" + "x-ms-request-id" : "8dbafe98-701e-00d7-7260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:07 GMT", + "x-ms-client-request-id" : "fac4408f-2c9d-42d2-982b-029b57564c01" }, "Exception" : null }, { @@ -25,8 +25,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcemptybatch&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b90a1a35-dce9-4478-a641-018e3031cb25" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "cc6ad48f-236c-4a9e-825b-defd7f9d9c15" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -34,20 +34,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4483-d01e-007b-407a-845bc6000000", - "Body" : "jtcemptybatchjtcemptybatch0batchapitestemptybatche0b11844e22165d3aWed, 16 Oct 2019 23:38:04 GMT\"0x8D75291E4111982\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "b90a1a35-dce9-4478-a641-018e3031cb25", + "x-ms-request-id" : "8dbb007c-701e-00d7-7b60-b47a51000000", + "Body" : "jtcemptybatchjtcemptybatch0batchapitestemptybatchddf82741f4ff86e19Mon, 16 Dec 2019 22:30:08 GMT\"0x8D7827781D630E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "cc6ad48f-236c-4a9e-825b-defd7f9d9c15", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcemptybatch0batchapitestemptybatche0b11844e22165d3a?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcemptybatch0batchapitestemptybatchddf82741f4ff86e19?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "f7f6de59-57d0-4482-acf4-164ba6a17f6d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9226e9a5-36d5-4d84-9606-639987d54a95" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -55,11 +55,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed44bc-d01e-007b-737a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "f7f6de59-57d0-4482-acf4-164ba6a17f6d" + "x-ms-request-id" : "8dbb0140-701e-00d7-2960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "9226e9a5-36d5-4d84-9606-639987d54a95" }, "Exception" : null } ], - "variables" : [ "jtcemptybatch0batchapitestemptybatche0b11844e22165d3a" ] + "variables" : [ "jtcemptybatch0batchapitestemptybatchddf82741f4ff86e19" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestmixedbatch.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestmixedbatch.json index 1ab19dd847a9..6247885d75da 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestmixedbatch.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestmixedbatch.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcmixedbatch0batchapitestmixedbatch97922492ff2ef7d82?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcmixedbatch0batchapitestmixedbatchb1a39126116fc1417?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "7866be74-071f-4dbe-9fbc-b3778633a59c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7e1a22a0-0d8c-46a3-9b32-b30210a73848" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E4542683", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:05 GMT", + "ETag" : "0x8D7827782442851", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:09 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed44da-d01e-007b-0b7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "7866be74-071f-4dbe-9fbc-b3778633a59c" + "x-ms-request-id" : "8dbb0182-701e-00d7-6a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "7e1a22a0-0d8c-46a3-9b32-b30210a73848" }, "Exception" : null }, { @@ -25,8 +25,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcmixedbatch&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "7482378e-962f-49ec-8582-f0229773e89a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f4db30b7-d204-4879-aad3-8b172dd1fec4" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -34,20 +34,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed44fd-d01e-007b-257a-845bc6000000", - "Body" : "jtcmixedbatchjtcmixedbatch0batchapitestmixedbatch97922492ff2ef7d82Wed, 16 Oct 2019 23:38:05 GMT\"0x8D75291E4542683\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "7482378e-962f-49ec-8582-f0229773e89a", + "x-ms-request-id" : "8dbb01cf-701e-00d7-2860-b47a51000000", + "Body" : "jtcmixedbatchjtcmixedbatch0batchapitestmixedbatchb1a39126116fc1417Mon, 16 Dec 2019 22:30:09 GMT\"0x8D7827782442851\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "f4db30b7-d204-4879-aad3-8b172dd1fec4", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcmixedbatch0batchapitestmixedbatch97922492ff2ef7d82?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcmixedbatch0batchapitestmixedbatchb1a39126116fc1417?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "215c5ddc-ddc8-4f19-9111-84c5428fe2d0" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a9120851-d9af-4d11-bd0b-d76fdeadaff2" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -55,11 +55,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed450c-d01e-007b-317a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "215c5ddc-ddc8-4f19-9111-84c5428fe2d0" + "x-ms-request-id" : "8dbb0207-701e-00d7-5960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "a9120851-d9af-4d11-bd0b-d76fdeadaff2" }, "Exception" : null } ], - "variables" : [ "jtcmixedbatch0batchapitestmixedbatch97922492ff2ef7d82" ] + "variables" : [ "jtcmixedbatch0batchapitestmixedbatchb1a39126116fc1417" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettierallsucceed.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettierallsucceed.json index c2f5fe9fa821..57eedf7f39c3 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettierallsucceed.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettierallsucceed.json @@ -1,94 +1,94 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed0batchapitestsettierallsucceed8b763830eb?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed0batchapitestsettierallsucceed3f8384455a?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "e5e2180c-d9f0-4175-af6f-0f523bfc0c79" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "42642d7e-5f08-4532-85dc-1ceb376eb6d6" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E46B36A2", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:05 GMT", + "ETag" : "0x8D782778259D869", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:09 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed451a-d01e-007b-3d7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "e5e2180c-d9f0-4175-af6f-0f523bfc0c79" + "x-ms-request-id" : "8dbb024c-701e-00d7-1460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "42642d7e-5f08-4532-85dc-1ceb376eb6d6" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed8b7618999d?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed3f815399b8?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "70595794-33af-4daf-8d44-738d23272abe" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "01051d2c-5dae-4b12-a919-503f521b64e8" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E472D9A6", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:05 GMT", + "ETag" : "0x8D7827782610612", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:09 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4528-d01e-007b-497a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", - "x-ms-client-request-id" : "70595794-33af-4daf-8d44-738d23272abe" + "x-ms-request-id" : "8dbb0292-701e-00d7-5260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", + "x-ms-client-request-id" : "01051d2c-5dae-4b12-a919-503f521b64e8" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed8b7618999d/javablobsettierallsucceed2564926008cd3da159431e", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed3f815399b8/javablobsettierallsucceed2080677a5f1638be584a47", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "a8f8b33d-2ada-4ffa-8872-4f9a4a3433c6", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f743c2ae-3f4f-4a52-b407-af1436dbb97a", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:05 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:09 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E4858B49", + "ETag" : "0x8D7827782766E66", "Content-Length" : "0", - "x-ms-request-id" : "a0ed454b-d01e-007b-687a-845bc6000000", - "x-ms-client-request-id" : "a8f8b33d-2ada-4ffa-8872-4f9a4a3433c6" + "x-ms-request-id" : "8dbb0313-701e-00d7-4760-b47a51000000", + "x-ms-client-request-id" : "f743c2ae-3f4f-4a52-b407-af1436dbb97a" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed8b7618999d/javablobsettierallsucceed37420473b4987f1297402f", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed3f815399b8/javablobsettierallsucceed35435620960787da704639", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "54fc71a7-a1b5-4a46-9d6e-f49a06898d84", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "18bcf0ac-4dcb-4fee-8e6d-060efcc40e81", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:05 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:09 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:04 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:08 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E495468A", + "ETag" : "0x8D78277827D7503", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4561-d01e-007b-7a7a-845bc6000000", - "x-ms-client-request-id" : "54fc71a7-a1b5-4a46-9d6e-f49a06898d84" + "x-ms-request-id" : "8dbb0365-701e-00d7-1260-b47a51000000", + "x-ms-client-request-id" : "18bcf0ac-4dcb-4fee-8e6d-060efcc40e81" }, "Exception" : null }, { @@ -96,9 +96,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "157a08f2-0632-4d1d-a531-cf80167b0074", - "Content-Type" : "multipart/mixed; boundary=batch_72d381cd-5fe9-479b-9b37-f46eb0808276" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7df0201e-dd9f-427a-acc5-e89fd91e01bd", + "Content-Type" : "multipart/mixed; boundary=batch_a3eabf0b-aa03-4b96-9479-5dbc527f93fa" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -106,11 +106,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed457a-d01e-007b-127a-845bc6000000", - "Body" : "--batchresponse_2e3abb2d-c84d-4a63-a4bd-bf05179b94d5\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: a0ed457a-d01e-007b-127a-845bc61e1042\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: b9067874-3342-4351-9547-a26e5324e6fd\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_2e3abb2d-c84d-4a63-a4bd-bf05179b94d5\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: a0ed457a-d01e-007b-127a-845bc61e1045\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 69117cd3-bd24-4667-b5b2-68eafa7e5069\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_2e3abb2d-c84d-4a63-a4bd-bf05179b94d5--", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "157a08f2-0632-4d1d-a531-cf80167b0074", - "Content-Type" : "multipart/mixed; boundary=batchresponse_2e3abb2d-c84d-4a63-a4bd-bf05179b94d5" + "x-ms-request-id" : "8dbb03c3-701e-00d7-6860-b47a51000000", + "Body" : "--batchresponse_8aa26607-11ef-4721-845e-9588f5df4353\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb03c3-701e-00d7-6860-b47a511e9be7\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 54bc8bd0-aff7-4394-b92e-2b1c8b9fd88d\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_8aa26607-11ef-4721-845e-9588f5df4353\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb03c3-701e-00d7-6860-b47a511e9beb\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: d7790c1a-25e1-4cf7-b3e7-0274acff385f\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_8aa26607-11ef-4721-845e-9588f5df4353--", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "7df0201e-dd9f-427a-acc5-e89fd91e01bd", + "Content-Type" : "multipart/mixed; boundary=batchresponse_8aa26607-11ef-4721-845e-9588f5df4353" }, "Exception" : null }, { @@ -118,8 +118,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierallsucceed&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "abf01920-e12a-441c-8e5a-6f30bcce3d13" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bc8d6ac7-6fdd-488b-a580-671874ed3a7b" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -127,20 +127,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed45c4-d01e-007b-507a-845bc6000000", - "Body" : "jtcsettierallsucceedjtcsettierallsucceed0batchapitestsettierallsucceed8b763830ebWed, 16 Oct 2019 23:38:05 GMT\"0x8D75291E46B36A2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettierallsucceed1batchapitestsettierallsucceed8b7618999dWed, 16 Oct 2019 23:38:05 GMT\"0x8D75291E472D9A6\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "abf01920-e12a-441c-8e5a-6f30bcce3d13", + "x-ms-request-id" : "8dbb04d1-701e-00d7-6360-b47a51000000", + "Body" : "jtcsettierallsucceedjtcsettierallsucceed0batchapitestsettierallsucceed3f8384455aMon, 16 Dec 2019 22:30:09 GMT\"0x8D782778259D869\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettierallsucceed1batchapitestsettierallsucceed3f815399b8Mon, 16 Dec 2019 22:30:09 GMT\"0x8D7827782610612\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "bc8d6ac7-6fdd-488b-a580-671874ed3a7b", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed0batchapitestsettierallsucceed8b763830eb?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed0batchapitestsettierallsucceed3f8384455a?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "ed762cc5-c53b-4a1c-9a61-655ed1e808dc" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c69f27e8-e8b5-4a2f-a0c0-cd7e15f11038" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -148,18 +148,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35173-201e-006e-7c7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "ed762cc5-c53b-4a1c-9a61-655ed1e808dc" + "x-ms-request-id" : "8dbb050a-701e-00d7-1b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "c69f27e8-e8b5-4a2f-a0c0-cd7e15f11038" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed8b7618999d?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierallsucceed1batchapitestsettierallsucceed3f815399b8?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "fb1b5ee1-35f1-48ac-a5f8-94b9cfedb8c4" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "65643134-edf0-46f9-acbf-8b0c5394f88f" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -167,11 +167,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed464e-d01e-007b-467a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "fb1b5ee1-35f1-48ac-a5f8-94b9cfedb8c4" + "x-ms-request-id" : "8dbb0538-701e-00d7-4560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "65643134-edf0-46f9-acbf-8b0c5394f88f" }, "Exception" : null } ], - "variables" : [ "jtcsettierallsucceed0batchapitestsettierallsucceed8b763830eb", "jtcsettierallsucceed1batchapitestsettierallsucceed8b7618999d", "javablobsettierallsucceed2564926008cd3da159431e", "javablobsettierallsucceed37420473b4987f1297402f" ] + "variables" : [ "jtcsettierallsucceed0batchapitestsettierallsucceed3f8384455a", "jtcsettierallsucceed1batchapitestsettierallsucceed3f815399b8", "javablobsettierallsucceed2080677a5f1638be584a47", "javablobsettierallsucceed35435620960787da704639" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceeddonotthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceeddonotthrowonanyerror.json index e9b1067b7793..fcc397f32178 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceeddonotthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceeddonotthrowonanyerror.json @@ -1,44 +1,44 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror0468828c018e8b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror089776ac2aa818?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "291597d9-ed88-4d27-b226-e1523561dbb0" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a4e2da92-2ed6-4b49-849b-4ec12fce7b88" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5BACF07", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D782778340C60C", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e3546d-201e-006e-167a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "291597d9-ed88-4d27-b226-e1523561dbb0" + "x-ms-request-id" : "8dbb08d2-701e-00d7-1060-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "a4e2da92-2ed6-4b49-849b-4ec12fce7b88" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror1309717e7f87b0?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror100570ea2fd148?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "b8d40fbf-d823-40c5-9edd-4ee9e0f41f39" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2058c138-663f-42be-861f-56cd280d5616" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5C093EB", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D7827783466CB8", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:11 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4801-d01e-007b-3d7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "b8d40fbf-d823-40c5-9edd-4ee9e0f41f39" + "x-ms-request-id" : "8dbb08f2-701e-00d7-2e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "2058c138-663f-42be-861f-56cd280d5616" }, "Exception" : null }, { @@ -46,9 +46,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "6179023d-35b2-4587-b3fd-b6182433b606", - "Content-Type" : "multipart/mixed; boundary=batch_d0357343-9cb1-47f5-8e5f-45ff904e2260" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "61d01ae5-5da2-4ae8-88c9-056b31e7d750", + "Content-Type" : "multipart/mixed; boundary=batch_aa419ddc-e4c1-4605-8eb2-ceab6938dd51" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -56,11 +56,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35491-201e-006e-367a-84995f000000", - "Body" : "--batchresponse_4eabb6cb-42bc-4076-85e6-90a0c7d5dd48\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35491-201e-006e-367a-84995f1e4bb3\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 07c3368c-4427-4580-a829-0d3a86af0cc8\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35491-201e-006e-367a-84995f1e4bb3\nTime:2019-10-16T23:38:07.4976002Z\r\n--batchresponse_4eabb6cb-42bc-4076-85e6-90a0c7d5dd48\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e35491-201e-006e-367a-84995f1e4bb5\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 5a4e0bcd-159b-4749-a34c-6826d4aac081\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e35491-201e-006e-367a-84995f1e4bb5\nTime:2019-10-16T23:38:07.4976002Z\r\n--batchresponse_4eabb6cb-42bc-4076-85e6-90a0c7d5dd48--", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "6179023d-35b2-4587-b3fd-b6182433b606", - "Content-Type" : "multipart/mixed; boundary=batchresponse_4eabb6cb-42bc-4076-85e6-90a0c7d5dd48" + "x-ms-request-id" : "8dbb0912-701e-00d7-4860-b47a51000000", + "Body" : "--batchresponse_094c5bff-5fd2-4413-b52d-2a152bdd56ef\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0912-701e-00d7-4860-b47a511e9c17\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 01a7f6b1-bb0c-4ce8-9a6d-c3924051056b\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0912-701e-00d7-4860-b47a511e9c17\nTime:2019-12-16T22:30:11.1794684Z\r\n--batchresponse_094c5bff-5fd2-4413-b52d-2a152bdd56ef\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0912-701e-00d7-4860-b47a511e9c19\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: db4c7185-8791-4508-88ac-3ec5aa5f18fe\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0912-701e-00d7-4860-b47a511e9c19\nTime:2019-12-16T22:30:11.1784677Z\r\n--batchresponse_094c5bff-5fd2-4413-b52d-2a152bdd56ef--", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "61d01ae5-5da2-4ae8-88c9-056b31e7d750", + "Content-Type" : "multipart/mixed; boundary=batchresponse_094c5bff-5fd2-4413-b52d-2a152bdd56ef" }, "Exception" : null }, { @@ -68,8 +68,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettiernonesucceeddonotthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "7eba04eb-6658-4252-a3f3-7ea5a5c010ab" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7aa90074-7fde-45ca-aa63-0dac6d6ec5a3" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -77,20 +77,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed4813-d01e-007b-4b7a-845bc6000000", - "Body" : "jtcsettiernonesucceeddonotthrowonanyerrorjtcsettiernonesucceeddonotthrowonanyerror0468828c018e8bWed, 16 Oct 2019 23:38:07 GMT\"0x8D75291E5BACF07\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiernonesucceeddonotthrowonanyerror1309717e7f87b0Wed, 16 Oct 2019 23:38:07 GMT\"0x8D75291E5C093EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "7eba04eb-6658-4252-a3f3-7ea5a5c010ab", + "x-ms-request-id" : "8dbb092b-701e-00d7-5d60-b47a51000000", + "Body" : "jtcsettiernonesucceeddonotthrowonanyerrorjtcsettiernonesucceeddonotthrowonanyerror089776ac2aa818Mon, 16 Dec 2019 22:30:11 GMT\"0x8D782778340C60C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiernonesucceeddonotthrowonanyerror100570ea2fd148Mon, 16 Dec 2019 22:30:11 GMT\"0x8D7827783466CB8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "7aa90074-7fde-45ca-aa63-0dac6d6ec5a3", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror0468828c018e8b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror089776ac2aa818?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "140a4739-e116-40aa-a7dd-6296f173b31b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0f42b520-1ca5-4b35-acb7-fc60b07a61cb" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -98,18 +98,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e354b3-201e-006e-507a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "140a4739-e116-40aa-a7dd-6296f173b31b" + "x-ms-request-id" : "8dbb0947-701e-00d7-7860-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "0f42b520-1ca5-4b35-acb7-fc60b07a61cb" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror1309717e7f87b0?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceeddonotthrowonanyerror100570ea2fd148?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "ad77d6b6-345f-4079-ac2a-989acba47ff8" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9fd0ace4-b547-4b3d-aef9-19dce35c9c3a" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -117,11 +117,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4833-d01e-007b-667a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "ad77d6b6-345f-4079-ac2a-989acba47ff8" + "x-ms-request-id" : "8dbb0960-701e-00d7-1060-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "9fd0ace4-b547-4b3d-aef9-19dce35c9c3a" }, "Exception" : null } ], - "variables" : [ "jtcsettiernonesucceeddonotthrowonanyerror0468828c018e8b", "jtcsettiernonesucceeddonotthrowonanyerror1309717e7f87b0", "javablobsettiernonesucceeddonotthrowonanyerror260916b46d4", "javablobsettiernonesucceeddonotthrowonanyerror3346329fcb1" ] + "variables" : [ "jtcsettiernonesucceeddonotthrowonanyerror089776ac2aa818", "jtcsettiernonesucceeddonotthrowonanyerror100570ea2fd148", "javablobsettiernonesucceeddonotthrowonanyerror233943406e9", "javablobsettiernonesucceeddonotthrowonanyerror351160c3044" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceedthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceedthrowonanyerror.json index fcf2f44443a6..71525fcaa6de 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceedthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiernonesucceedthrowonanyerror.json @@ -1,44 +1,44 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror0284624a0d37d5ba?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror0214110ca4ba4a63?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "4b660799-60e2-461d-b291-af85c68c4bc4" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ad14d12d-f093-4c06-8af1-1f702ca1e7c0" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E5908091", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D78277831A703F", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e353da-201e-006e-1e7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "4b660799-60e2-461d-b291-af85c68c4bc4" + "x-ms-request-id" : "8dbb080a-701e-00d7-5f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "ad14d12d-f093-4c06-8af1-1f702ca1e7c0" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror1611235d53065363?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror18225580bf01a641?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "e95ba399-aa67-45e8-846b-30f40fbb981c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7888d76d-2240-489b-acba-0113dac9cb51" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E598DDD4", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:07 GMT", + "ETag" : "0x8D7827783203DF9", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed47b3-d01e-007b-7c7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "e95ba399-aa67-45e8-846b-30f40fbb981c" + "x-ms-request-id" : "8dbb0827-701e-00d7-7a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "7888d76d-2240-489b-acba-0113dac9cb51" }, "Exception" : null }, { @@ -46,9 +46,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "a2532709-b46b-426c-bb32-ef1f97a0a582", - "Content-Type" : "multipart/mixed; boundary=batch_075eaa0c-56c2-4bbe-b6b6-e6a512ad864e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "016b2cdb-c6de-432d-bd68-7249ced3a984", + "Content-Type" : "multipart/mixed; boundary=batch_9676f986-13b3-43e7-8bd4-33a918bbaae5" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -56,11 +56,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e3541a-201e-006e-507a-84995f000000", - "Body" : "--batchresponse_923ebe8c-e839-410d-b30a-4aea6e9d2805\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e3541a-201e-006e-507a-84995f1e4ba7\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 80e09ee6-e7a8-4477-89fe-5d0e17d6dac2\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e3541a-201e-006e-507a-84995f1e4ba7\nTime:2019-10-16T23:38:07.2543710Z\r\n--batchresponse_923ebe8c-e839-410d-b30a-4aea6e9d2805\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e3541a-201e-006e-507a-84995f1e4ba9\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 41b78b17-390d-4f9b-ad0f-516fab9fc207\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e3541a-201e-006e-507a-84995f1e4ba9\nTime:2019-10-16T23:38:07.2543710Z\r\n--batchresponse_923ebe8c-e839-410d-b30a-4aea6e9d2805--", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "a2532709-b46b-426c-bb32-ef1f97a0a582", - "Content-Type" : "multipart/mixed; boundary=batchresponse_923ebe8c-e839-410d-b30a-4aea6e9d2805" + "x-ms-request-id" : "8dbb0845-701e-00d7-1560-b47a51000000", + "Body" : "--batchresponse_9422ec1b-bcc9-4e8f-ba09-8e47e7a1f84e\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0845-701e-00d7-1560-b47a511e9c0d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 9131c082-518c-453c-993d-5989eb446d46\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0845-701e-00d7-1560-b47a511e9c0d\nTime:2019-12-16T22:30:10.9262323Z\r\n--batchresponse_9422ec1b-bcc9-4e8f-ba09-8e47e7a1f84e\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0845-701e-00d7-1560-b47a511e9c0f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c9188491-9bfe-4498-9711-dc050550d798\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0845-701e-00d7-1560-b47a511e9c0f\nTime:2019-12-16T22:30:10.9262323Z\r\n--batchresponse_9422ec1b-bcc9-4e8f-ba09-8e47e7a1f84e--", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "016b2cdb-c6de-432d-bd68-7249ced3a984", + "Content-Type" : "multipart/mixed; boundary=batchresponse_9422ec1b-bcc9-4e8f-ba09-8e47e7a1f84e" }, "Exception" : null }, { @@ -68,8 +68,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettiernonesucceedthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "601752f8-1034-4b38-aab6-1c0d4f09d3a7" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "56b6f0d7-5de6-4149-ab35-0d1fba2b6271" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -77,20 +77,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed47d4-d01e-007b-147a-845bc6000000", - "Body" : "jtcsettiernonesucceedthrowonanyerrorjtcsettiernonesucceedthrowonanyerror0284624a0d37d5baWed, 16 Oct 2019 23:38:07 GMT\"0x8D75291E5908091\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiernonesucceedthrowonanyerror1611235d53065363Wed, 16 Oct 2019 23:38:07 GMT\"0x8D75291E598DDD4\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "601752f8-1034-4b38-aab6-1c0d4f09d3a7", + "x-ms-request-id" : "8dbb086a-701e-00d7-3660-b47a51000000", + "Body" : "jtcsettiernonesucceedthrowonanyerrorjtcsettiernonesucceedthrowonanyerror0214110ca4ba4a63Mon, 16 Dec 2019 22:30:10 GMT\"0x8D78277831A703F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiernonesucceedthrowonanyerror18225580bf01a641Mon, 16 Dec 2019 22:30:10 GMT\"0x8D7827783203DF9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "56b6f0d7-5de6-4149-ab35-0d1fba2b6271", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror0284624a0d37d5ba?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror0214110ca4ba4a63?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "3fe41a4d-a4fe-4c21-acf6-d208932c8d99" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "06d2fc82-7d1a-4347-b27b-ef111dc3e6d4" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -98,18 +98,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35445-201e-006e-757a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "3fe41a4d-a4fe-4c21-acf6-d208932c8d99" + "x-ms-request-id" : "8dbb0880-701e-00d7-4a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "06d2fc82-7d1a-4347-b27b-ef111dc3e6d4" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror1611235d53065363?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiernonesucceedthrowonanyerror18225580bf01a641?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "138c013f-5948-489b-83bd-bbcf82e53e3c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d690d7cf-b690-48ea-bc57-950499157e00" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -117,11 +117,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed47ec-d01e-007b-2a7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "138c013f-5948-489b-83bd-bbcf82e53e3c" + "x-ms-request-id" : "8dbb089e-701e-00d7-6460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:10 GMT", + "x-ms-client-request-id" : "d690d7cf-b690-48ea-bc57-950499157e00" }, "Exception" : null } ], - "variables" : [ "jtcsettiernonesucceedthrowonanyerror0284624a0d37d5ba", "jtcsettiernonesucceedthrowonanyerror1611235d53065363", "javablobsettiernonesucceedthrowonanyerror25913826aeb703", "javablobsettiernonesucceedthrowonanyerror3049334df40b1c" ] + "variables" : [ "jtcsettiernonesucceedthrowonanyerror0214110ca4ba4a63", "jtcsettiernonesucceedthrowonanyerror18225580bf01a641", "javablobsettiernonesucceedthrowonanyerror293856462da63c", "javablobsettiernonesucceedthrowonanyerror319786f7fe6e09" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceeddonotthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceeddonotthrowonanyerror.json index ad7654635f36..57d29dea51ed 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceeddonotthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceeddonotthrowonanyerror.json @@ -1,69 +1,69 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror0467166f40024b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror07919083f11725?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "791842d0-2ebd-41da-baad-8a8b88ed20b5" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "88634a61-744b-408d-b407-55244790d957" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E53DAEFF", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:06 GMT", + "ETag" : "0x8D7827782EAC953", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed46f6-d01e-007b-5b7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "791842d0-2ebd-41da-baad-8a8b88ed20b5" + "x-ms-request-id" : "8dbb0701-701e-00d7-6960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "88634a61-744b-408d-b407-55244790d957" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror1658554daeac55?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror199445668c3541?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "fae4686e-6b16-46a8-a2b9-dc93346c22cc" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ece97a79-95c3-4363-870b-7b06c3aaff67" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E543D4B3", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:06 GMT", + "ETag" : "0x8D7827782F79DA8", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e3528e-201e-006e-787a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "fae4686e-6b16-46a8-a2b9-dc93346c22cc" + "x-ms-request-id" : "8dbb075f-701e-00d7-4060-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "ece97a79-95c3-4363-870b-7b06c3aaff67" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror1658554daeac55/javablobsettiersomesucceeddonotthrowonanyerror2456863a585", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror199445668c3541/javablobsettiersomesucceeddonotthrowonanyerror28307240213", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "7a4798e8-bfcc-46a9-ad0b-f99bc2738798", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b48e4586-4e47-4d6f-8e7b-e9411bfae17c", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:06 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E554CD31", + "ETag" : "0x8D7827782FD99DF", "Content-Length" : "0", - "x-ms-request-id" : "a0ed4717-d01e-007b-777a-845bc6000000", - "x-ms-client-request-id" : "7a4798e8-bfcc-46a9-ad0b-f99bc2738798" + "x-ms-request-id" : "8dbb077b-701e-00d7-5a60-b47a51000000", + "x-ms-client-request-id" : "b48e4586-4e47-4d6f-8e7b-e9411bfae17c" }, "Exception" : null }, { @@ -71,9 +71,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "88b75356-821a-4626-8309-f8837151f4fe", - "Content-Type" : "multipart/mixed; boundary=batch_6289616b-30d3-4163-a54e-8e434ad7fcdd" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dd21dc83-5553-4d1a-8574-ee4a71efdc90", + "Content-Type" : "multipart/mixed; boundary=batch_e5a54b70-0707-49e2-99bc-fdf442b44494" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -81,11 +81,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e352f2-201e-006e-517a-84995f000000", - "Body" : "--batchresponse_dfa35da8-006a-48d5-afdc-fc542d16f4a2\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 92e352f2-201e-006e-517a-84995f1e4b9b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 30ff0717-19b2-4374-a4d4-f46b67fd804c\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_dfa35da8-006a-48d5-afdc-fc542d16f4a2\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 92e352f2-201e-006e-517a-84995f1e4b9e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2c07e9de-37f2-4443-89b5-0b6818f7c7ab\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:92e352f2-201e-006e-517a-84995f1e4b9e\nTime:2019-10-16T23:38:06.9701049Z\r\n--batchresponse_dfa35da8-006a-48d5-afdc-fc542d16f4a2--", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "88b75356-821a-4626-8309-f8837151f4fe", - "Content-Type" : "multipart/mixed; boundary=batchresponse_dfa35da8-006a-48d5-afdc-fc542d16f4a2" + "x-ms-request-id" : "8dbb079a-701e-00d7-7960-b47a51000000", + "Body" : "--batchresponse_d5fe7bff-25eb-4292-a177-315daea37824\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb079a-701e-00d7-7960-b47a511e9c00\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 198af58c-418d-47e1-af39-6f7acfd83ca6\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_d5fe7bff-25eb-4292-a177-315daea37824\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb079a-701e-00d7-7960-b47a511e9c02\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 01d858f8-2361-4112-9514-a7c716fd2c4c\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb079a-701e-00d7-7960-b47a511e9c02\nTime:2019-12-16T22:30:10.7010219Z\r\n--batchresponse_d5fe7bff-25eb-4292-a177-315daea37824--", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "dd21dc83-5553-4d1a-8574-ee4a71efdc90", + "Content-Type" : "multipart/mixed; boundary=batchresponse_d5fe7bff-25eb-4292-a177-315daea37824" }, "Exception" : null }, { @@ -93,8 +93,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettiersomesucceeddonotthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "34555320-20cc-4f18-ae6e-0aa2ddf892c4" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b5ff97b4-1e57-47bc-a6e7-a615e9ec87f5" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -102,20 +102,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "a0ed476b-d01e-007b-3d7a-845bc6000000", - "Body" : "jtcsettiersomesucceeddonotthrowonanyerrorjtcsettiersomesucceeddonotthrowonanyerror0467166f40024bWed, 16 Oct 2019 23:38:06 GMT\"0x8D75291E53DAEFF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiersomesucceeddonotthrowonanyerror1658554daeac55Wed, 16 Oct 2019 23:38:06 GMT\"0x8D75291E543D4B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "34555320-20cc-4f18-ae6e-0aa2ddf892c4", + "x-ms-request-id" : "8dbb07b5-701e-00d7-1160-b47a51000000", + "Body" : "jtcsettiersomesucceeddonotthrowonanyerrorjtcsettiersomesucceeddonotthrowonanyerror07919083f11725Mon, 16 Dec 2019 22:30:10 GMT\"0x8D7827782EAC953\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiersomesucceeddonotthrowonanyerror199445668c3541Mon, 16 Dec 2019 22:30:10 GMT\"0x8D7827782F79DA8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "b5ff97b4-1e57-47bc-a6e7-a615e9ec87f5", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror0467166f40024b?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror07919083f11725?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "19b24f9a-312a-4df0-838d-701a46551efc" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "98c4a793-f20e-4c5c-bbd0-0fa0fc7c0541" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -123,18 +123,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35397-201e-006e-697a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "19b24f9a-312a-4df0-838d-701a46551efc" + "x-ms-request-id" : "8dbb07cf-701e-00d7-2760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "98c4a793-f20e-4c5c-bbd0-0fa0fc7c0541" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror1658554daeac55?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceeddonotthrowonanyerror199445668c3541?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "e4e3585d-d3ee-4da4-a333-8a27ab1db51e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9f0f5c5c-f122-4a61-887d-659ccb259ed9" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -142,11 +142,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed4790-d01e-007b-5e7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:06 GMT", - "x-ms-client-request-id" : "e4e3585d-d3ee-4da4-a333-8a27ab1db51e" + "x-ms-request-id" : "8dbb07e9-701e-00d7-4160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "9f0f5c5c-f122-4a61-887d-659ccb259ed9" }, "Exception" : null } ], - "variables" : [ "jtcsettiersomesucceeddonotthrowonanyerror0467166f40024b", "jtcsettiersomesucceeddonotthrowonanyerror1658554daeac55", "javablobsettiersomesucceeddonotthrowonanyerror2456863a585", "javablobsettiersomesucceeddonotthrowonanyerror3937793747c" ] + "variables" : [ "jtcsettiersomesucceeddonotthrowonanyerror07919083f11725", "jtcsettiersomesucceeddonotthrowonanyerror199445668c3541", "javablobsettiersomesucceeddonotthrowonanyerror28307240213", "javablobsettiersomesucceeddonotthrowonanyerror389811d54c1" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceedthrowonanyerror.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceedthrowonanyerror.json index 70a2ca36fe87..4662200c59eb 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceedthrowonanyerror.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsettiersomesucceedthrowonanyerror.json @@ -1,69 +1,69 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror011069b305f66540?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror026379a0cbcb7128?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "71b827f4-6851-494c-a189-d33a49ac4687" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "23053e04-965f-4fd5-a40e-55585266ae0b" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E501647F", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:06 GMT", + "ETag" : "0x8D7827782B6182A", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "92e351af-201e-006e-327a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "71b827f4-6851-494c-a189-d33a49ac4687" + "x-ms-request-id" : "8dbb0569-701e-00d7-7260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "23053e04-965f-4fd5-a40e-55585266ae0b" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror1672046b8cf6cbc5?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror13210029654d78eb?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c2338ef9-6de8-48ee-9eb2-a316192f1eb3" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "72bde97d-e47d-4149-96a8-135bcc504986" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75291E507EBB4", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:06 GMT", + "ETag" : "0x8D7827782BBBEDB", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "a0ed4679-d01e-007b-6b7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "c2338ef9-6de8-48ee-9eb2-a316192f1eb3" + "x-ms-request-id" : "8dbb05a0-701e-00d7-2660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "72bde97d-e47d-4149-96a8-135bcc504986" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror1672046b8cf6cbc5/javablobsettiersomesucceedthrowonanyerror247425f8b98527", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror13210029654d78eb/javablobsettiersomesucceedthrowonanyerror209002bf12fce0", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c4019ab6-6397-409f-966b-f66991e5ac40", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ebe0a2b8-c0bb-48d8-9fbe-7d701c7217b0", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Wed, 16 Oct 2019 23:38:06 GMT", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:10 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75291E51395B2", + "ETag" : "0x8D7827782C16C77", "Content-Length" : "0", - "x-ms-request-id" : "92e351de-201e-006e-5e7a-84995f000000", - "x-ms-client-request-id" : "c4019ab6-6397-409f-966b-f66991e5ac40" + "x-ms-request-id" : "8dbb05d5-701e-00d7-5660-b47a51000000", + "x-ms-client-request-id" : "ebe0a2b8-c0bb-48d8-9fbe-7d701c7217b0" }, "Exception" : null }, { @@ -71,9 +71,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "deab4e2e-e8e9-4a75-ac30-8ca33c296688", - "Content-Type" : "multipart/mixed; boundary=batch_482df4d5-b4a2-48c7-b180-12fb14621d06" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a8985a0d-9432-47f1-90a0-e4f73ea23cd6", + "Content-Type" : "multipart/mixed; boundary=batch_9ba393d0-8890-442e-87c7-5c37aa7fe1f6" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -81,11 +81,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed46b2-d01e-007b-207a-845bc6000000", - "Body" : "--batchresponse_08436707-754a-4d27-8f36-101382ffb135\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: a0ed46b2-d01e-007b-207a-845bc61e105b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c255c7a0-d71c-4aa1-ad54-03dfa96ed743\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_08436707-754a-4d27-8f36-101382ffb135\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: a0ed46b2-d01e-007b-207a-845bc61e105d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2df1ad9e-bff8-460b-81e8-7191c39f45ba\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:a0ed46b2-d01e-007b-207a-845bc61e105d\nTime:2019-10-16T23:38:06.3692838Z\r\n--batchresponse_08436707-754a-4d27-8f36-101382ffb135--", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "deab4e2e-e8e9-4a75-ac30-8ca33c296688", - "Content-Type" : "multipart/mixed; boundary=batchresponse_08436707-754a-4d27-8f36-101382ffb135" + "x-ms-request-id" : "8dbb0614-701e-00d7-0d60-b47a51000000", + "Body" : "--batchresponse_05f150b6-ddd5-4a91-a6d4-5c41dfc4f692\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 200 OK\r\nx-ms-request-id: 8dbb0614-701e-00d7-0d60-b47a511e9bf5\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c5381cc2-b573-46e4-95f9-148d27a82639\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_05f150b6-ddd5-4a91-a6d4-5c41dfc4f692\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb0614-701e-00d7-0d60-b47a511e9bf7\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: eed32359-3a4e-49c2-b924-b1dcbe7ddbb8\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb0614-701e-00d7-0d60-b47a511e9bf7\nTime:2019-12-16T22:30:10.3016494Z\r\n--batchresponse_05f150b6-ddd5-4a91-a6d4-5c41dfc4f692--", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "a8985a0d-9432-47f1-90a0-e4f73ea23cd6", + "Content-Type" : "multipart/mixed; boundary=batchresponse_05f150b6-ddd5-4a91-a6d4-5c41dfc4f692" }, "Exception" : null }, { @@ -93,8 +93,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettiersomesucceedthrowonanyerror&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "e391abc5-d757-480c-bd72-21f704357342" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e6d0c30e-9631-4b22-b458-365b5a9b4c09" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -102,20 +102,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "92e35205-201e-006e-7e7a-84995f000000", - "Body" : "jtcsettiersomesucceedthrowonanyerrorjtcsettiersomesucceedthrowonanyerror011069b305f66540Wed, 16 Oct 2019 23:38:06 GMT\"0x8D75291E501647F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiersomesucceedthrowonanyerror1672046b8cf6cbc5Wed, 16 Oct 2019 23:38:06 GMT\"0x8D75291E507EBB4\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "e391abc5-d757-480c-bd72-21f704357342", + "x-ms-request-id" : "8dbb0645-701e-00d7-3c60-b47a51000000", + "Body" : "jtcsettiersomesucceedthrowonanyerrorjtcsettiersomesucceedthrowonanyerror026379a0cbcb7128Mon, 16 Dec 2019 22:30:10 GMT\"0x8D7827782B6182A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsettiersomesucceedthrowonanyerror13210029654d78ebMon, 16 Dec 2019 22:30:10 GMT\"0x8D7827782BBBEDB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "e6d0c30e-9631-4b22-b458-365b5a9b4c09", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror011069b305f66540?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror026379a0cbcb7128?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "5bd9ce07-1a1e-4449-a262-a6b29787cf7d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7b24ff7d-42e6-46d0-a24b-c0387ee84843" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -123,18 +123,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "a0ed46d7-d01e-007b-3f7a-845bc6000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "5bd9ce07-1a1e-4449-a262-a6b29787cf7d" + "x-ms-request-id" : "8dbb066f-701e-00d7-6260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "7b24ff7d-42e6-46d0-a24b-c0387ee84843" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror1672046b8cf6cbc5?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiersomesucceedthrowonanyerror13210029654d78eb?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "c2240bb3-aed6-448b-bfc7-130f48bf5851" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2e60c7b6-70e9-44f7-944b-9b04bf621ba4" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -142,11 +142,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "92e35235-201e-006e-2a7a-84995f000000", - "Date" : "Wed, 16 Oct 2019 23:38:05 GMT", - "x-ms-client-request-id" : "c2240bb3-aed6-448b-bfc7-130f48bf5851" + "x-ms-request-id" : "8dbb0696-701e-00d7-0660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:09 GMT", + "x-ms-client-request-id" : "2e60c7b6-70e9-44f7-944b-9b04bf621ba4" }, "Exception" : null } ], - "variables" : [ "jtcsettiersomesucceedthrowonanyerror011069b305f66540", "jtcsettiersomesucceedthrowonanyerror1672046b8cf6cbc5", "javablobsettiersomesucceedthrowonanyerror247425f8b98527", "javablobsettiersomesucceedthrowonanyerror32300068a9ed2e" ] + "variables" : [ "jtcsettiersomesucceedthrowonanyerror026379a0cbcb7128", "jtcsettiersomesucceedthrowonanyerror13210029654d78eb", "javablobsettiersomesucceedthrowonanyerror209002bf12fce0", "javablobsettiersomesucceedthrowonanyerror30181002f3b9d5" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsingleoperationexceptionthrowsblobbatchstorageexception.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsingleoperationexceptionthrowsblobbatchstorageexception.json new file mode 100644 index 000000000000..9f79214eed88 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsingleoperationexceptionthrowsblobbatchstorageexception.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsingleoperationexceptionthrowsblobbatchstorageexce00836441?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f8e819a8-ac51-4f72-913e-9886e860b5cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827785745993", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb13a5-701e-00d7-7d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "f8e819a8-ac51-4f72-913e-9886e860b5cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsingleoperationexceptionthrowsblobbatchstorageexce115043fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1c312240-3ef1-4685-988b-6acc57baee79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277857C71EC", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb13cd-701e-00d7-1e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "1c312240-3ef1-4685-988b-6acc57baee79" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "31413e37-ccb7-4cc9-8029-dcc9d8af1314", + "Content-Type" : "multipart/mixed; boundary=batch_25655962-167e-4d8b-aae6-4ac1b68c2280" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb13e5-701e-00d7-3460-b47a51000000", + "Body" : "--batchresponse_f18a07f5-9929-4cd9-8499-4c8e5fa1417f\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb13e5-701e-00d7-3460-b47a511e9cc2\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c4c69972-0d80-458c-bdf8-2c79edbc9c7b\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb13e5-701e-00d7-3460-b47a511e9cc2\nTime:2019-12-16T22:30:14.8829312Z\r\n--batchresponse_f18a07f5-9929-4cd9-8499-4c8e5fa1417f--", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "31413e37-ccb7-4cc9-8029-dcc9d8af1314", + "Content-Type" : "multipart/mixed; boundary=batchresponse_f18a07f5-9929-4cd9-8499-4c8e5fa1417f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsingleoperationexceptionthrowsblobbatchstorageexce&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "519ed4ce-4fd3-4b26-b1eb-8c238646c25c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb13f9-701e-00d7-4860-b47a51000000", + "Body" : "jtcsingleoperationexceptionthrowsblobbatchstorageexcejtcsingleoperationexceptionthrowsblobbatchstorageexce00836441Mon, 16 Dec 2019 22:30:14 GMT\"0x8D7827785745993\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsingleoperationexceptionthrowsblobbatchstorageexce115043faMon, 16 Dec 2019 22:30:14 GMT\"0x8D78277857C71EC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "519ed4ce-4fd3-4b26-b1eb-8c238646c25c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsingleoperationexceptionthrowsblobbatchstorageexce00836441?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0eb69344-a832-480e-9c52-147f8b48e698" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb141c-701e-00d7-6a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "0eb69344-a832-480e-9c52-147f8b48e698" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsingleoperationexceptionthrowsblobbatchstorageexce115043fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b7f5c286-6c94-48cc-a86a-93024fc341c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb143b-701e-00d7-0960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "b7f5c286-6c94-48cc-a86a-93024fc341c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsingleoperationexceptionthrowsblobbatchstorageexce00836441", "jtcsingleoperationexceptionthrowsblobbatchstorageexce115043fa", "192f5bd87b344e31a8f62c3342067dd03cf20520cd384f208b2d9f27c5ae5fbb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[0].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[0].json new file mode 100644 index 000000000000..6141e21ac743 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[0].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes039926de3b4045e5204?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4fbec57c-afe6-4edf-b8bc-ad0200c48e8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277859E80E5", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb147f-701e-00d7-4760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "4fbec57c-afe6-4edf-b8bc-ad0200c48e8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes192877e63eff1bf1d44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f48762ea-cfc0-4473-b42e-e0028e070822" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827785A4007A", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb149c-701e-00d7-5f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "f48762ea-cfc0-4473-b42e-e0028e070822" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes192877e63eff1bf1d44/javablobsubmittingsamebatchmanytimes357610ab3d3b7e92", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "00d5dd79-4748-4373-923f-8264652c2cb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827785A98B81", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb14b7-701e-00d7-7960-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "00d5dd79-4748-4373-923f-8264652c2cb0" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0ae8fc0a-4d0e-48e8-9ba5-799262f42368", + "Content-Type" : "multipart/mixed; boundary=batch_905e3502-e22d-4c28-acee-e133c0beeb79" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb14d5-701e-00d7-1360-b47a51000000", + "Body" : "--batchresponse_70008e99-8238-4bee-bd3c-95d766fbef00\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb14d5-701e-00d7-1360-b47a511e9ccc\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 891761f4-cdf5-4a6c-997e-40a1144f9a43\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb14d5-701e-00d7-1360-b47a511e9ccc\nTime:2019-12-16T22:30:15.1832115Z\r\n--batchresponse_70008e99-8238-4bee-bd3c-95d766fbef00\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb14d5-701e-00d7-1360-b47a511e9cce\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 881a3980-ef9e-40d2-ac73-fe3ab7476db5\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_70008e99-8238-4bee-bd3c-95d766fbef00--", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "0ae8fc0a-4d0e-48e8-9ba5-799262f42368", + "Content-Type" : "multipart/mixed; boundary=batchresponse_70008e99-8238-4bee-bd3c-95d766fbef00" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "faf981e5-8d0f-4c08-8b5d-e63f61d084b9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb14f0-701e-00d7-2c60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes039926de3b4045e5204Mon, 16 Dec 2019 22:30:15 GMT\"0x8D78277859E80E5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes192877e63eff1bf1d44Mon, 16 Dec 2019 22:30:15 GMT\"0x8D7827785A4007A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "faf981e5-8d0f-4c08-8b5d-e63f61d084b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes039926de3b4045e5204?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2c69479e-fe48-409e-b0ac-63d7a90674b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1500-701e-00d7-3b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "2c69479e-fe48-409e-b0ac-63d7a90674b2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes192877e63eff1bf1d44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "32521c09-d2d4-42f3-8fd0-654020f2a894" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1524-701e-00d7-5d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "32521c09-d2d4-42f3-8fd0-654020f2a894" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes039926de3b4045e5204", "jtcsubmittingsamebatchmanytimes192877e63eff1bf1d44", "javablobsubmittingsamebatchmanytimes255324de17bd5d32", "javablobsubmittingsamebatchmanytimes357610ab3d3b7e92" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[10].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[10].json new file mode 100644 index 000000000000..422b415cfe07 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[10].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes037619cdfbde46bc6d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3c3aac92-a4a2-4ba9-9820-12b5458c2fa7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787633252", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1d50-701e-00d7-5160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "3c3aac92-a4a2-4ba9-9820-12b5458c2fa7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes146980a0655b3441ca4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "993e2a96-1a1a-4532-8855-a0cb10df5147" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277876863AB", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1d6a-701e-00d7-6560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "993e2a96-1a1a-4532-8855-a0cb10df5147" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes146980a0655b3441ca4/javablobsubmittingsamebatchmanytimes33378034298bdba7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2a7f5ff1-b743-4d39-b0c5-2376fc7d8f92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277876DCAA5", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1d7e-701e-00d7-7860-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "2a7f5ff1-b743-4d39-b0c5-2376fc7d8f92" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "40150acf-5f03-455b-bb97-03df260b7785", + "Content-Type" : "multipart/mixed; boundary=batch_ab63aea8-7b8a-405e-a524-fe88b02e0477" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1d91-701e-00d7-0a60-b47a51000000", + "Body" : "--batchresponse_85cc1a6c-a76b-409e-b2ae-29db3cbbda34\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1d91-701e-00d7-0a60-b47a511e9d48\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 4352dc1a-e1f8-4047-90a3-c4aab41757ba\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1d91-701e-00d7-0a60-b47a511e9d48\nTime:2019-12-16T22:30:18.1359672Z\r\n--batchresponse_85cc1a6c-a76b-409e-b2ae-29db3cbbda34\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1d91-701e-00d7-0a60-b47a511e9d4b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 1747fc18-ef18-4fa1-ad94-575ad55dd479\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_85cc1a6c-a76b-409e-b2ae-29db3cbbda34--", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "40150acf-5f03-455b-bb97-03df260b7785", + "Content-Type" : "multipart/mixed; boundary=batchresponse_85cc1a6c-a76b-409e-b2ae-29db3cbbda34" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1dab24cc-13b3-41df-832b-147ec3bf0ae3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1d9f-701e-00d7-1860-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes037619cdfbde46bc6d4Mon, 16 Dec 2019 22:30:18 GMT\"0x8D7827787633252\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes146980a0655b3441ca4Mon, 16 Dec 2019 22:30:18 GMT\"0x8D78277876863AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "1dab24cc-13b3-41df-832b-147ec3bf0ae3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes037619cdfbde46bc6d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "95dc4330-41d5-4b7a-93cb-00af54cd8005" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1dac-701e-00d7-2560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "95dc4330-41d5-4b7a-93cb-00af54cd8005" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes146980a0655b3441ca4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0947e029-363f-4c61-bccd-2da5ba41a8b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1dc0-701e-00d7-3960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "0947e029-363f-4c61-bccd-2da5ba41a8b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes037619cdfbde46bc6d4", "jtcsubmittingsamebatchmanytimes146980a0655b3441ca4", "javablobsubmittingsamebatchmanytimes2274924d21772994", "javablobsubmittingsamebatchmanytimes33378034298bdba7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[11].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[11].json new file mode 100644 index 000000000000..dcd226bc357e --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[11].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0610583726b5eb3b614?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "351c309d-ec6a-48f2-b474-ca5eb16a6db7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778788C4AC", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1dd7-701e-00d7-4e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "351c309d-ec6a-48f2-b474-ca5eb16a6db7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes153624bea75c75da504?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f207578f-f653-40f2-80fc-c3ecdccd0822" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277878DCEF3", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1df6-701e-00d7-6860-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "f207578f-f653-40f2-80fc-c3ecdccd0822" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes153624bea75c75da504/javablobsubmittingsamebatchmanytimes370346ab6d3be362", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ae8be6ba-5bfa-46ec-8e6e-84f76b50cc65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778792E7EF", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1e18-701e-00d7-0660-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "ae8be6ba-5bfa-46ec-8e6e-84f76b50cc65" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "17c8a624-ed4d-43a6-9ba9-a68cb8c2d300", + "Content-Type" : "multipart/mixed; boundary=batch_b69a2f62-dfd8-461c-b544-01066788a6c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1e38-701e-00d7-2360-b47a51000000", + "Body" : "--batchresponse_20f19d39-44d5-4499-b10d-b5d56047fa03\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1e38-701e-00d7-2360-b47a511e9d53\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 5cac0781-3d11-4c2b-9d1c-a327ac4ce944\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1e38-701e-00d7-2360-b47a511e9d53\nTime:2019-12-16T22:30:18.3791943Z\r\n--batchresponse_20f19d39-44d5-4499-b10d-b5d56047fa03\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1e38-701e-00d7-2360-b47a511e9d55\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 47ffb074-649f-4f3e-9795-e3afd737c2b5\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_20f19d39-44d5-4499-b10d-b5d56047fa03--", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "17c8a624-ed4d-43a6-9ba9-a68cb8c2d300", + "Content-Type" : "multipart/mixed; boundary=batchresponse_20f19d39-44d5-4499-b10d-b5d56047fa03" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6f2beaa1-8b7f-4623-905a-9e727c4f7c3b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1e53-701e-00d7-3e60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0610583726b5eb3b614Mon, 16 Dec 2019 22:30:18 GMT\"0x8D782778788C4AC\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes153624bea75c75da504Mon, 16 Dec 2019 22:30:18 GMT\"0x8D78277878DCEF3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "6f2beaa1-8b7f-4623-905a-9e727c4f7c3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0610583726b5eb3b614?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2f0145fc-f16f-4fae-a28a-9105332e7d34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1e6e-701e-00d7-5660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "2f0145fc-f16f-4fae-a28a-9105332e7d34" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes153624bea75c75da504?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "74a5eb71-6352-46a5-9b2d-8bd775660cd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1e7f-701e-00d7-6760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "74a5eb71-6352-46a5-9b2d-8bd775660cd3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0610583726b5eb3b614", "jtcsubmittingsamebatchmanytimes153624bea75c75da504", "javablobsubmittingsamebatchmanytimes272937114606ee07", "javablobsubmittingsamebatchmanytimes370346ab6d3be362" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[12].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[12].json new file mode 100644 index 000000000000..9324822f404b --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[12].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0076084a5d3da9da594?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ba1ab0db-9101-4566-a5cf-2b57a814f6b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787AB21FB", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1e9e-701e-00d7-0660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "ba1ab0db-9101-4566-a5cf-2b57a814f6b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1149713be1f59bae8f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "45334a19-0160-436f-9ef2-1710d5a4ff0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787AFDE16", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1eba-701e-00d7-1e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "45334a19-0160-436f-9ef2-1710d5a4ff0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1149713be1f59bae8f4/javablobsubmittingsamebatchmanytimes384226b249653c0d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9894771c-fe84-40af-9d2f-d3a6a8eae922" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787B56C83", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1ece-701e-00d7-2f60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "9894771c-fe84-40af-9d2f-d3a6a8eae922" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "31ac90c1-26b1-45fe-8b55-238ca99d7610", + "Content-Type" : "multipart/mixed; boundary=batch_6301ef37-2a1a-47db-b9d0-19f869fd4e16" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1edb-701e-00d7-3c60-b47a51000000", + "Body" : "--batchresponse_9503cf40-06c5-4868-87c6-d47a6077d9b9\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1edb-701e-00d7-3c60-b47a511e9d5b\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 7c2080f5-b042-48db-aa3a-29007ba5e7d6\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1edb-701e-00d7-3c60-b47a511e9d5b\nTime:2019-12-16T22:30:18.6074097Z\r\n--batchresponse_9503cf40-06c5-4868-87c6-d47a6077d9b9\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1edb-701e-00d7-3c60-b47a511e9d5d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c835410c-489e-4c31-8410-dff1e50fbca0\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_9503cf40-06c5-4868-87c6-d47a6077d9b9--", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "31ac90c1-26b1-45fe-8b55-238ca99d7610", + "Content-Type" : "multipart/mixed; boundary=batchresponse_9503cf40-06c5-4868-87c6-d47a6077d9b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "339b2d55-a232-4e39-9f53-152c0f3cd202" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1efd-701e-00d7-5c60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0076084a5d3da9da594Mon, 16 Dec 2019 22:30:18 GMT\"0x8D7827787AB21FB\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes1149713be1f59bae8f4Mon, 16 Dec 2019 22:30:18 GMT\"0x8D7827787AFDE16\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "339b2d55-a232-4e39-9f53-152c0f3cd202", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0076084a5d3da9da594?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "24583d4d-41ca-4760-ab0e-59ddc628a39c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1f20-701e-00d7-7d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "24583d4d-41ca-4760-ab0e-59ddc628a39c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1149713be1f59bae8f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d2e1ee0a-f739-40b1-8a2e-af53bd612729" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1f45-701e-00d7-2260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "d2e1ee0a-f739-40b1-8a2e-af53bd612729" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0076084a5d3da9da594", "jtcsubmittingsamebatchmanytimes1149713be1f59bae8f4", "javablobsubmittingsamebatchmanytimes2386647a3ba40500", "javablobsubmittingsamebatchmanytimes384226b249653c0d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[13].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[13].json new file mode 100644 index 000000000000..fb2cad11f6c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[13].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0922735b4067fc51164?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e8381085-efd2-4f4e-8c4e-41459619c84c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787CEB827", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1f61-701e-00d7-3e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "e8381085-efd2-4f4e-8c4e-41459619c84c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes154692ca2a765ac5264?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "157035de-52f2-4945-bcf2-206dc89fb6ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787D3E979", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1f7f-701e-00d7-5a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "157035de-52f2-4945-bcf2-206dc89fb6ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes154692ca2a765ac5264/javablobsubmittingsamebatchmanytimes389881cf0b6ea4cf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9716c344-98ed-4dbb-9db2-e1fd575c0e12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787DA62B6", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1f9a-701e-00d7-7360-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "9716c344-98ed-4dbb-9db2-e1fd575c0e12" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "70cd5704-b177-4a2d-86d6-a871d4135258", + "Content-Type" : "multipart/mixed; boundary=batch_9fc66eed-30eb-4c19-b010-aaa3afeb9037" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1fad-701e-00d7-0660-b47a51000000", + "Body" : "--batchresponse_99581959-2618-49fd-8b35-9e659636cd3d\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1fad-701e-00d7-0660-b47a511e9d64\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: e34e66cb-99ee-4184-933f-e4ed509c6d0a\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1fad-701e-00d7-0660-b47a511e9d64\nTime:2019-12-16T22:30:18.8566433Z\r\n--batchresponse_99581959-2618-49fd-8b35-9e659636cd3d\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1fad-701e-00d7-0660-b47a511e9d66\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 9aba4e89-660f-49b4-9d51-f2d7e749a682\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_99581959-2618-49fd-8b35-9e659636cd3d--", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "70cd5704-b177-4a2d-86d6-a871d4135258", + "Content-Type" : "multipart/mixed; boundary=batchresponse_99581959-2618-49fd-8b35-9e659636cd3d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "49d79645-3967-449b-974a-aa1c79519e70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1fba-701e-00d7-1360-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0922735b4067fc51164Mon, 16 Dec 2019 22:30:18 GMT\"0x8D7827787CEB827\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes154692ca2a765ac5264Mon, 16 Dec 2019 22:30:18 GMT\"0x8D7827787D3E979\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "49d79645-3967-449b-974a-aa1c79519e70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0922735b4067fc51164?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d57ca0a6-6a8a-4f87-a4f1-cc746a27bc00" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1fcb-701e-00d7-2460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "d57ca0a6-6a8a-4f87-a4f1-cc746a27bc00" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes154692ca2a765ac5264?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bbdc0c74-9eb2-4d9a-ada9-a8fddd942d7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1fe0-701e-00d7-3860-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "bbdc0c74-9eb2-4d9a-ada9-a8fddd942d7b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0922735b4067fc51164", "jtcsubmittingsamebatchmanytimes154692ca2a765ac5264", "javablobsubmittingsamebatchmanytimes2087789fb04b93a3", "javablobsubmittingsamebatchmanytimes389881cf0b6ea4cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[14].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[14].json new file mode 100644 index 000000000000..7b1b8b214948 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[14].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes096439b754681603924?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f6f45d5e-45ab-4d93-8de8-d806ac7bf50d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787F3FC55", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1ff5-701e-00d7-4a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "f6f45d5e-45ab-4d93-8de8-d806ac7bf50d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes117755f7b0748e68ea4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7616ce42-a5e6-44bf-8fab-ca87be7fc494" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787F92DB9", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1fff-701e-00d7-5360-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "7616ce42-a5e6-44bf-8fab-ca87be7fc494" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes117755f7b0748e68ea4/javablobsubmittingsamebatchmanytimes3883151ceeb38290", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d0b96fe9-a794-49e8-b7ff-d5350ec49fec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787FE472F", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb2013-701e-00d7-6460-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "d0b96fe9-a794-49e8-b7ff-d5350ec49fec" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ca6c6b5d-11dd-4486-b17c-0c69acbe1086", + "Content-Type" : "multipart/mixed; boundary=batch_35d697fa-f76e-404d-a9d8-6fec25c193d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb202a-701e-00d7-7560-b47a51000000", + "Body" : "--batchresponse_10b95308-436b-4ad2-8986-cac262f08eb4\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb202a-701e-00d7-7560-b47a511e9d6c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 4abd1e40-294d-4bc9-92fe-9b6a881c6133\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb202a-701e-00d7-7560-b47a511e9d6c\nTime:2019-12-16T22:30:19.0838561Z\r\n--batchresponse_10b95308-436b-4ad2-8986-cac262f08eb4\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb202a-701e-00d7-7560-b47a511e9d6e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 047d643b-e22b-4c57-9f22-5409f9cdcd66\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_10b95308-436b-4ad2-8986-cac262f08eb4--", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "ca6c6b5d-11dd-4486-b17c-0c69acbe1086", + "Content-Type" : "multipart/mixed; boundary=batchresponse_10b95308-436b-4ad2-8986-cac262f08eb4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f4a3d4b1-d2df-42b6-868e-9f4a85461b16" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb203f-701e-00d7-0860-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes096439b754681603924Mon, 16 Dec 2019 22:30:18 GMT\"0x8D7827787F3FC55\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes117755f7b0748e68ea4Mon, 16 Dec 2019 22:30:19 GMT\"0x8D7827787F92DB9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "f4a3d4b1-d2df-42b6-868e-9f4a85461b16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes096439b754681603924?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "15330416-0706-44cd-ac9f-2425a9fdf9d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2048-701e-00d7-1160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "15330416-0706-44cd-ac9f-2425a9fdf9d1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes117755f7b0748e68ea4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2b0c2e26-26c5-47a8-bad8-c41a4e229d43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2058-701e-00d7-2060-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "2b0c2e26-26c5-47a8-bad8-c41a4e229d43" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes096439b754681603924", "jtcsubmittingsamebatchmanytimes117755f7b0748e68ea4", "javablobsubmittingsamebatchmanytimes269104f7f2337045", "javablobsubmittingsamebatchmanytimes3883151ceeb38290" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[15].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[15].json new file mode 100644 index 000000000000..aab69a792fef --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[15].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes014508007254e27b3d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ee4d3815-465b-4637-9fa5-e35e5da8641f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788283846", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb20aa-701e-00d7-6b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "ee4d3815-465b-4637-9fa5-e35e5da8641f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes14066820d765d3567d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "75de55ce-0ee0-45da-b25d-cf8221b34c94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788302970", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb20cc-701e-00d7-0960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "75de55ce-0ee0-45da-b25d-cf8221b34c94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes14066820d765d3567d4/javablobsubmittingsamebatchmanytimes352756878db861d6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c4a811e9-f4e2-4ed5-ab83-ee6b82128f81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788362DBC", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb20e3-701e-00d7-1e60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "c4a811e9-f4e2-4ed5-ab83-ee6b82128f81" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6e93e505-11a1-4e33-adee-2adcadc85e43", + "Content-Type" : "multipart/mixed; boundary=batch_1b44441b-3d50-41be-8075-dc3d82099da5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2107-701e-00d7-4160-b47a51000000", + "Body" : "--batchresponse_cc8bbf90-9648-43b4-a01e-ad17ecc6bfe7\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb2107-701e-00d7-4160-b47a511e9d7f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: fac6cda7-0550-4557-a318-75f0c6ef1814\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb2107-701e-00d7-4160-b47a511e9d7f\nTime:2019-12-16T22:30:19.4752232Z\r\n--batchresponse_cc8bbf90-9648-43b4-a01e-ad17ecc6bfe7\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb2107-701e-00d7-4160-b47a511e9d81\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: fe01258a-d8c7-4b11-9a34-e62a67342e03\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_cc8bbf90-9648-43b4-a01e-ad17ecc6bfe7--", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "6e93e505-11a1-4e33-adee-2adcadc85e43", + "Content-Type" : "multipart/mixed; boundary=batchresponse_cc8bbf90-9648-43b4-a01e-ad17ecc6bfe7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8a928e74-2c6c-45f2-915d-81d33060e24f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb2122-701e-00d7-5860-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes014508007254e27b3d4Mon, 16 Dec 2019 22:30:19 GMT\"0x8D7827788283846\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes14066820d765d3567d4Mon, 16 Dec 2019 22:30:19 GMT\"0x8D7827788302970\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "8a928e74-2c6c-45f2-915d-81d33060e24f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes014508007254e27b3d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fad2a037-8662-4a78-b18d-eb434223df3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2138-701e-00d7-6e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "fad2a037-8662-4a78-b18d-eb434223df3e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes14066820d765d3567d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "738e4601-aaca-4448-b883-be9868159534" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2151-701e-00d7-0460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "738e4601-aaca-4448-b883-be9868159534" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes014508007254e27b3d4", "jtcsubmittingsamebatchmanytimes14066820d765d3567d4", "javablobsubmittingsamebatchmanytimes21758951dfa6e64c", "javablobsubmittingsamebatchmanytimes352756878db861d6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[16].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[16].json new file mode 100644 index 000000000000..98d5d248e19c --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[16].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes052922eb5b926ef2a44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "25716663-53fa-443d-9881-7b35b8051eb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788545BF2", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb2167-701e-00d7-1860-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "25716663-53fa-443d-9881-7b35b8051eb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1326122891da1fddcf4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e6fcdcf9-3da8-4790-9be0-b558e7620bed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788598D3D", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb217d-701e-00d7-2d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "e6fcdcf9-3da8-4790-9be0-b558e7620bed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1326122891da1fddcf4/javablobsubmittingsamebatchmanytimes3052246c397b06d3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6f041e2f-ff58-4309-85e7-e02e94a5a401" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277885F6AB7", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb219a-701e-00d7-4760-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "6f041e2f-ff58-4309-85e7-e02e94a5a401" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e09a2cf2-3826-4903-bfe9-8fc1e4aca532", + "Content-Type" : "multipart/mixed; boundary=batch_ba49a92a-e5d5-486f-b828-6c74c3ed6fc8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb21bc-701e-00d7-6560-b47a51000000", + "Body" : "--batchresponse_649675ce-4da7-4de0-a81a-e5c866209221\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb21bc-701e-00d7-6560-b47a511e9d90\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 8cb25e8b-3e1e-4c17-861e-f0f427e3cc16\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb21bc-701e-00d7-6560-b47a511e9d90\nTime:2019-12-16T22:30:19.7404714Z\r\n--batchresponse_649675ce-4da7-4de0-a81a-e5c866209221\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb21bc-701e-00d7-6560-b47a511e9d92\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: f8ef978f-f4a3-44d3-a466-9ccd83b38ab3\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_649675ce-4da7-4de0-a81a-e5c866209221--", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "e09a2cf2-3826-4903-bfe9-8fc1e4aca532", + "Content-Type" : "multipart/mixed; boundary=batchresponse_649675ce-4da7-4de0-a81a-e5c866209221" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "97e76e04-66ba-4d80-b39d-ff2603b8a031" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb21f0-701e-00d7-1060-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes052922eb5b926ef2a44Mon, 16 Dec 2019 22:30:19 GMT\"0x8D7827788545BF2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes1326122891da1fddcf4Mon, 16 Dec 2019 22:30:19 GMT\"0x8D7827788598D3D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "97e76e04-66ba-4d80-b39d-ff2603b8a031", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes052922eb5b926ef2a44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f6e4a84e-7171-4cb6-adc8-1db3108b7b09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2201-701e-00d7-2160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:18 GMT", + "x-ms-client-request-id" : "f6e4a84e-7171-4cb6-adc8-1db3108b7b09" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1326122891da1fddcf4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "260ced67-9b9a-4415-81eb-b8aaa8839d44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2219-701e-00d7-3960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "260ced67-9b9a-4415-81eb-b8aaa8839d44" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes052922eb5b926ef2a44", "jtcsubmittingsamebatchmanytimes1326122891da1fddcf4", "javablobsubmittingsamebatchmanytimes24992064d3efc2b9", "javablobsubmittingsamebatchmanytimes3052246c397b06d3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[17].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[17].json new file mode 100644 index 000000000000..81f5a28907e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[17].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes072324d6452d5e1f574?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f31f4074-13fb-4182-8dec-a8fa757e6eb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778888226B", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb2253-701e-00d7-7160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "f31f4074-13fb-4182-8dec-a8fa757e6eb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes175055d232d7f73dfc4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "74fba7ef-e5db-4308-bb9d-61d2189e3e7a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277888F5019", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb226f-701e-00d7-0a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "74fba7ef-e5db-4308-bb9d-61d2189e3e7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes175055d232d7f73dfc4/javablobsubmittingsamebatchmanytimes36414660a0066bc1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8ebd607a-504b-4d28-bb88-b0d797358bea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277889506C7", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb228a-701e-00d7-2060-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "8ebd607a-504b-4d28-bb88-b0d797358bea" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "cd81f335-859a-49ed-8727-8ed85af35630", + "Content-Type" : "multipart/mixed; boundary=batch_a6524d8f-16dc-4391-be34-958d24d03222" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb22a0-701e-00d7-3260-b47a51000000", + "Body" : "--batchresponse_560a2a44-6ad8-4e8c-bed8-f59c73708fd8\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb22a0-701e-00d7-3260-b47a511e9da1\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c2fb9013-2cde-4164-83a5-90dd43ed0249\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb22a0-701e-00d7-3260-b47a511e9da1\nTime:2019-12-16T22:30:20.1928932Z\r\n--batchresponse_560a2a44-6ad8-4e8c-bed8-f59c73708fd8\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb22a0-701e-00d7-3260-b47a511e9da3\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 28247eee-f306-414c-bec7-85203186d0de\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_560a2a44-6ad8-4e8c-bed8-f59c73708fd8--", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "cd81f335-859a-49ed-8727-8ed85af35630", + "Content-Type" : "multipart/mixed; boundary=batchresponse_560a2a44-6ad8-4e8c-bed8-f59c73708fd8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "012e9973-0b5c-47a1-a310-8bb9df52f844" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb2337-701e-00d7-3a60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes072324d6452d5e1f574Mon, 16 Dec 2019 22:30:19 GMT\"0x8D782778888226B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes175055d232d7f73dfc4Mon, 16 Dec 2019 22:30:20 GMT\"0x8D78277888F5019\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "012e9973-0b5c-47a1-a310-8bb9df52f844", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes072324d6452d5e1f574?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "252d2a69-0292-43ba-bd29-252641bbf20b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2355-701e-00d7-5560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "252d2a69-0292-43ba-bd29-252641bbf20b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes175055d232d7f73dfc4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5cf3bdc0-f7d4-47fa-809e-42c873cbdcca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2376-701e-00d7-7460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "5cf3bdc0-f7d4-47fa-809e-42c873cbdcca" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes072324d6452d5e1f574", "jtcsubmittingsamebatchmanytimes175055d232d7f73dfc4", "javablobsubmittingsamebatchmanytimes223316519d0ba7db", "javablobsubmittingsamebatchmanytimes36414660a0066bc1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[18].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[18].json new file mode 100644 index 000000000000..5aa51a16df96 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[18].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0814410eac23b4d0c44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b504d37c-68e2-4168-b83c-234bd495c187" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788C9CF01", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb23c1-701e-00d7-3960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "b504d37c-68e2-4168-b83c-234bd495c187" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1727468219e11d50664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7f67ff91-f9bd-4e57-8494-c722dd1e14ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788D03925", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb23e3-701e-00d7-5460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "7f67ff91-f9bd-4e57-8494-c722dd1e14ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1727468219e11d50664/javablobsubmittingsamebatchmanytimes316149d2bc015462", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ccdbab28-c486-4fb4-bbc3-c5bab86abb22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788D701FB", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb2410-701e-00d7-7f60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "ccdbab28-c486-4fb4-bbc3-c5bab86abb22" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "29869351-701b-4924-9af7-909709fed713", + "Content-Type" : "multipart/mixed; boundary=batch_863d43c8-5908-4c24-b7c3-1a7021ddd5cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2438-701e-00d7-2460-b47a51000000", + "Body" : "--batchresponse_297b3177-e0b9-4473-bdd6-652f000f8f7f\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb2438-701e-00d7-2460-b47a511e9db6\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: f9ff8a6c-5fa9-4612-ab82-110c7659288c\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb2438-701e-00d7-2460-b47a511e9db6\nTime:2019-12-16T22:30:20.5061853Z\r\n--batchresponse_297b3177-e0b9-4473-bdd6-652f000f8f7f\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb2438-701e-00d7-2460-b47a511e9db8\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: a32ebc28-2505-47a0-b1b1-2c933107eb4e\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_297b3177-e0b9-4473-bdd6-652f000f8f7f--", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "29869351-701b-4924-9af7-909709fed713", + "Content-Type" : "multipart/mixed; boundary=batchresponse_297b3177-e0b9-4473-bdd6-652f000f8f7f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "adb35251-818e-41cb-9fa5-d599c384ba1c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb245e-701e-00d7-4760-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0814410eac23b4d0c44Mon, 16 Dec 2019 22:30:20 GMT\"0x8D7827788C9CF01\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes1727468219e11d50664Mon, 16 Dec 2019 22:30:20 GMT\"0x8D7827788D03925\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "adb35251-818e-41cb-9fa5-d599c384ba1c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0814410eac23b4d0c44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5ab7ca01-894d-4bcc-abd9-ebe573ed7bba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb247a-701e-00d7-6260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "5ab7ca01-894d-4bcc-abd9-ebe573ed7bba" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1727468219e11d50664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "13773600-966a-48ca-83a6-bd51d427e111" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb24a7-701e-00d7-0d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "13773600-966a-48ca-83a6-bd51d427e111" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0814410eac23b4d0c44", "jtcsubmittingsamebatchmanytimes1727468219e11d50664", "javablobsubmittingsamebatchmanytimes2609192f93c473a1", "javablobsubmittingsamebatchmanytimes316149d2bc015462" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[19].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[19].json new file mode 100644 index 000000000000..9f15adc44794 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[19].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes04680191a98021b2c24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6301d590-6dcf-4ff9-a52f-a959f84d7cdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788F13686", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb24c9-701e-00d7-2f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "6301d590-6dcf-4ff9-a52f-a959f84d7cdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes157010febe2714d8c84?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9dc75e0f-287f-4c8f-96d0-1d293c2de9be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788F6B620", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb24f3-701e-00d7-5660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "9dc75e0f-287f-4c8f-96d0-1d293c2de9be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes157010febe2714d8c84/javablobsubmittingsamebatchmanytimes3723733ab52e61e9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "53bef8dd-cc99-4d50-8a8c-01aede0d36fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827788FCBBB7", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb2518-701e-00d7-7860-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "53bef8dd-cc99-4d50-8a8c-01aede0d36fd" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "709aca10-9f16-4f9b-97c3-94a1a5feb627", + "Content-Type" : "multipart/mixed; boundary=batch_ae1c6d5a-f4ef-4cff-a3a8-ad2d954ce81e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2549-701e-00d7-2660-b47a51000000", + "Body" : "--batchresponse_2ecb09f9-fa6e-4d85-b31d-9df712a88b72\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb2549-701e-00d7-2660-b47a511e9dc6\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: d4ca237f-49e3-40ee-a0da-b7e9d02902a7\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb2549-701e-00d7-2660-b47a511e9dc6\nTime:2019-12-16T22:30:20.7524156Z\r\n--batchresponse_2ecb09f9-fa6e-4d85-b31d-9df712a88b72\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb2549-701e-00d7-2660-b47a511e9dc8\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: bb3f73c9-33e0-4e4e-80f2-7026ffb5c312\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_2ecb09f9-fa6e-4d85-b31d-9df712a88b72--", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "709aca10-9f16-4f9b-97c3-94a1a5feb627", + "Content-Type" : "multipart/mixed; boundary=batchresponse_2ecb09f9-fa6e-4d85-b31d-9df712a88b72" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bca137da-1d9b-4ccb-b89c-642d8838b3ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb2573-701e-00d7-4e60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes04680191a98021b2c24Mon, 16 Dec 2019 22:30:20 GMT\"0x8D7827788F13686\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes157010febe2714d8c84Mon, 16 Dec 2019 22:30:20 GMT\"0x8D7827788F6B620\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "bca137da-1d9b-4ccb-b89c-642d8838b3ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes04680191a98021b2c24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2f2bfecb-62e7-4f05-a91b-3fe248cf8b99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb2587-701e-00d7-6260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "2f2bfecb-62e7-4f05-a91b-3fe248cf8b99" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes157010febe2714d8c84?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "461281ee-4a0e-4703-af1c-bd1dcde8907c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb25a8-701e-00d7-0260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:19 GMT", + "x-ms-client-request-id" : "461281ee-4a0e-4703-af1c-bd1dcde8907c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes04680191a98021b2c24", "jtcsubmittingsamebatchmanytimes157010febe2714d8c84", "javablobsubmittingsamebatchmanytimes202726541258cb4c", "javablobsubmittingsamebatchmanytimes3723733ab52e61e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[1].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[1].json new file mode 100644 index 000000000000..ee4f5dc3e340 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[1].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes020971c7a81137f0964?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a4876a0b-17af-4860-89c2-81f070b8a283" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827785CB8F1B", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1548-701e-00d7-0160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "a4876a0b-17af-4860-89c2-81f070b8a283" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes18737945620415db7b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5e3f6b0b-3c90-456b-be3f-bfa2d8e36b3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827785D66725", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1576-701e-00d7-2960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "5e3f6b0b-3c90-456b-be3f-bfa2d8e36b3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes18737945620415db7b4/javablobsubmittingsamebatchmanytimes363202ff651bb2eb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ac790699-66bb-49c8-b3b9-33fcbd1d9c1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827785DD7983", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1598-701e-00d7-4860-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "ac790699-66bb-49c8-b3b9-33fcbd1d9c1f" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1bfc4f5f-f6c8-4055-b691-e1ec0d10f372", + "Content-Type" : "multipart/mixed; boundary=batch_803dc15b-0353-4485-843e-73298b3ad8ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb15bb-701e-00d7-6660-b47a51000000", + "Body" : "--batchresponse_092028e2-f710-40b8-8d26-8d871cb7909d\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb15bb-701e-00d7-6660-b47a511e9cdf\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 4046b042-62e8-43ff-811a-a972df0e78be\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb15bb-701e-00d7-6660-b47a511e9cdf\nTime:2019-12-16T22:30:15.5475529Z\r\n--batchresponse_092028e2-f710-40b8-8d26-8d871cb7909d\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb15bb-701e-00d7-6660-b47a511e9ce1\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 3e69b546-311f-4bcd-aa7e-f4b192ca0815\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_092028e2-f710-40b8-8d26-8d871cb7909d--", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "1bfc4f5f-f6c8-4055-b691-e1ec0d10f372", + "Content-Type" : "multipart/mixed; boundary=batchresponse_092028e2-f710-40b8-8d26-8d871cb7909d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1b9da097-d70f-49ef-b5db-66b97b507ef9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb15d0-701e-00d7-7860-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes020971c7a81137f0964Mon, 16 Dec 2019 22:30:15 GMT\"0x8D7827785CB8F1B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes18737945620415db7b4Mon, 16 Dec 2019 22:30:15 GMT\"0x8D7827785D66725\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "1b9da097-d70f-49ef-b5db-66b97b507ef9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes020971c7a81137f0964?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c428ded5-9b80-43ce-985f-6d594b4247d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb15f1-701e-00d7-1360-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "c428ded5-9b80-43ce-985f-6d594b4247d2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes18737945620415db7b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a0d40373-3b7e-43d8-9c18-48cfb7d11f72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb160d-701e-00d7-2960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "a0d40373-3b7e-43d8-9c18-48cfb7d11f72" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes020971c7a81137f0964", "jtcsubmittingsamebatchmanytimes18737945620415db7b4", "javablobsubmittingsamebatchmanytimes2678652794c9a4b1", "javablobsubmittingsamebatchmanytimes363202ff651bb2eb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[2].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[2].json new file mode 100644 index 000000000000..333d8ddb7f29 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[2].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0247041e9eac94bae24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2658f0d8-94c7-485c-851e-78d284446130" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786004049", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb162a-701e-00d7-4360-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "2658f0d8-94c7-485c-851e-78d284446130" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1340595601eb0390604?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "924929dc-b883-4660-a380-f77f95a81e91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778605E6F5", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1640-701e-00d7-5860-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "924929dc-b883-4660-a380-f77f95a81e91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1340595601eb0390604/javablobsubmittingsamebatchmanytimes300818a7d36e1857", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "338f9297-7231-4742-a3bf-00ab80f4243e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277860BE7E3", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb165c-701e-00d7-7160-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "338f9297-7231-4742-a3bf-00ab80f4243e" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9bf9ce5e-b6ea-4c3c-be33-69f28513408a", + "Content-Type" : "multipart/mixed; boundary=batch_32861c02-28b2-4cd2-8c10-0d15a7f7057d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1676-701e-00d7-0760-b47a51000000", + "Body" : "--batchresponse_0f290bac-4017-4660-be07-57762f9e9f71\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1676-701e-00d7-0760-b47a511e9cea\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 0080ee46-547b-4ca4-8597-6d36278167ad\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1676-701e-00d7-0760-b47a511e9cea\nTime:2019-12-16T22:30:15.8408250Z\r\n--batchresponse_0f290bac-4017-4660-be07-57762f9e9f71\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1676-701e-00d7-0760-b47a511e9cec\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 33d5fe12-3379-49a8-9a5e-abdc9028cfd5\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_0f290bac-4017-4660-be07-57762f9e9f71--", + "Date" : "Mon, 16 Dec 2019 22:30:14 GMT", + "x-ms-client-request-id" : "9bf9ce5e-b6ea-4c3c-be33-69f28513408a", + "Content-Type" : "multipart/mixed; boundary=batchresponse_0f290bac-4017-4660-be07-57762f9e9f71" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "380b33d5-44d9-4369-9228-ef3fd51e7ad3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb16af-701e-00d7-3b60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0247041e9eac94bae24Mon, 16 Dec 2019 22:30:15 GMT\"0x8D7827786004049\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes1340595601eb0390604Mon, 16 Dec 2019 22:30:15 GMT\"0x8D782778605E6F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "380b33d5-44d9-4369-9228-ef3fd51e7ad3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0247041e9eac94bae24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "787e6a6f-7609-4dcb-b6a8-987ff64586a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb16c9-701e-00d7-5460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "787e6a6f-7609-4dcb-b6a8-987ff64586a9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1340595601eb0390604?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "220d6163-619e-486f-9889-a3402057ebbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb16e2-701e-00d7-6d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "220d6163-619e-486f-9889-a3402057ebbf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0247041e9eac94bae24", "jtcsubmittingsamebatchmanytimes1340595601eb0390604", "javablobsubmittingsamebatchmanytimes2207132955c09805", "javablobsubmittingsamebatchmanytimes300818a7d36e1857" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[3].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[3].json new file mode 100644 index 000000000000..53a0da0ae69d --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[3].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes00311939550b1b3fec4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6fb921d1-6174-4b4f-bd85-14c5120788c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786320A85", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1712-701e-00d7-1960-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "6fb921d1-6174-4b4f-bd85-14c5120788c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes191109561fa214254f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f2b2d36e-d6d7-4bc4-b285-4c0bb55d6f90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778637D851", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb173b-701e-00d7-3d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "f2b2d36e-d6d7-4bc4-b285-4c0bb55d6f90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes191109561fa214254f4/javablobsubmittingsamebatchmanytimes382011ede7e75e90", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f32ac708-1dc9-46db-ac32-752345ba4534" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277863D1614", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb174f-701e-00d7-4e60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "f32ac708-1dc9-46db-ac32-752345ba4534" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "63f36284-2e29-4fb6-a06f-efc06e467334", + "Content-Type" : "multipart/mixed; boundary=batch_97ddfd61-2092-4da0-9e57-fea31b080bf4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb176d-701e-00d7-6760-b47a51000000", + "Body" : "--batchresponse_fea669ce-7aa3-4a1c-bcff-7fa853f4dd33\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb176d-701e-00d7-6760-b47a511e9cfa\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 06d2f3cc-2bfe-4a35-9bda-2b0403e4edca\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb176d-701e-00d7-6760-b47a511e9cfa\nTime:2019-12-16T22:30:16.1431076Z\r\n--batchresponse_fea669ce-7aa3-4a1c-bcff-7fa853f4dd33\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb176d-701e-00d7-6760-b47a511e9cfc\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: b59093aa-e357-4579-a6ff-f24ad9f14279\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_fea669ce-7aa3-4a1c-bcff-7fa853f4dd33--", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "63f36284-2e29-4fb6-a06f-efc06e467334", + "Content-Type" : "multipart/mixed; boundary=batchresponse_fea669ce-7aa3-4a1c-bcff-7fa853f4dd33" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d836ef30-b8cc-4d89-b22f-332fd61758c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb17a5-701e-00d7-1c60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes00311939550b1b3fec4Mon, 16 Dec 2019 22:30:16 GMT\"0x8D7827786320A85\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes191109561fa214254f4Mon, 16 Dec 2019 22:30:16 GMT\"0x8D782778637D851\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "d836ef30-b8cc-4d89-b22f-332fd61758c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes00311939550b1b3fec4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "39a33fe8-5fea-47e1-be70-48dda0fd3580" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb17bb-701e-00d7-3160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "39a33fe8-5fea-47e1-be70-48dda0fd3580" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes191109561fa214254f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4e114c5d-556d-45d6-9a50-f0d60fe713a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb17d4-701e-00d7-4760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "4e114c5d-556d-45d6-9a50-f0d60fe713a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes00311939550b1b3fec4", "jtcsubmittingsamebatchmanytimes191109561fa214254f4", "javablobsubmittingsamebatchmanytimes2535365651e45275", "javablobsubmittingsamebatchmanytimes382011ede7e75e90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[4].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[4].json new file mode 100644 index 000000000000..53060aadeb79 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[4].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0450615914aba278434?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8ce76701-28b7-4ea3-a978-e0c309bb6ab5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277865E2E28", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb17f7-701e-00d7-6760-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "8ce76701-28b7-4ea3-a978-e0c309bb6ab5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes12535821f94f376a844?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "02939a0f-bfc7-4644-8cfa-7adb8a1ec0ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778663114E", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb180f-701e-00d7-7a60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "02939a0f-bfc7-4644-8cfa-7adb8a1ec0ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes12535821f94f376a844/javablobsubmittingsamebatchmanytimes361150628f8162e9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "481b6f95-d53b-431a-9ac2-d859b7a196bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277866912DC", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1836-701e-00d7-1e60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "481b6f95-d53b-431a-9ac2-d859b7a196bd" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "76a1f823-563f-4519-8df9-005226b6eb9c", + "Content-Type" : "multipart/mixed; boundary=batch_7cdbb3bd-0d96-4e4c-9bc7-49846e82278b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1853-701e-00d7-3a60-b47a51000000", + "Body" : "--batchresponse_a0145a88-cadb-458a-9fd9-5337a6c82b61\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1853-701e-00d7-3a60-b47a511e9d07\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: ed76cf44-13b3-4f88-8e08-55d07bf1ddd4\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1853-701e-00d7-3a60-b47a511e9d07\nTime:2019-12-16T22:30:16.4383829Z\r\n--batchresponse_a0145a88-cadb-458a-9fd9-5337a6c82b61\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1853-701e-00d7-3a60-b47a511e9d09\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 2e83e188-7b96-4878-b91b-7b90dd82fd6e\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_a0145a88-cadb-458a-9fd9-5337a6c82b61--", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "76a1f823-563f-4519-8df9-005226b6eb9c", + "Content-Type" : "multipart/mixed; boundary=batchresponse_a0145a88-cadb-458a-9fd9-5337a6c82b61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a39469a9-b0de-47ee-9d2c-c0b618179543" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1879-701e-00d7-5d60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0450615914aba278434Mon, 16 Dec 2019 22:30:16 GMT\"0x8D78277865E2E28\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes12535821f94f376a844Mon, 16 Dec 2019 22:30:16 GMT\"0x8D782778663114E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "a39469a9-b0de-47ee-9d2c-c0b618179543", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0450615914aba278434?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "491922c3-7b8a-45a5-a036-3ea085d003cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb188d-701e-00d7-7160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "491922c3-7b8a-45a5-a036-3ea085d003cb" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes12535821f94f376a844?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "06763f7d-da8c-432a-a8f3-47c3a8f011c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb18ab-701e-00d7-0c60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "06763f7d-da8c-432a-a8f3-47c3a8f011c5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0450615914aba278434", "jtcsubmittingsamebatchmanytimes12535821f94f376a844", "javablobsubmittingsamebatchmanytimes20370583b6e9896b", "javablobsubmittingsamebatchmanytimes361150628f8162e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[5].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[5].json new file mode 100644 index 000000000000..8afbbaa076ef --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[5].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0775660d9d61ddf7d14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "83396b44-29dc-4489-91df-bef6d1fbb482" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786887C8C", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb18ea-701e-00d7-4660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "83396b44-29dc-4489-91df-bef6d1fbb482" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes131852ca629d0bf04c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b34fffbb-de4d-4ae4-8d11-7e105970f078" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277868D5FBC", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1907-701e-00d7-5f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "b34fffbb-de4d-4ae4-8d11-7e105970f078" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes131852ca629d0bf04c4/javablobsubmittingsamebatchmanytimes31684051cf18ae55", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fd3164d1-a57d-49b2-bde7-523813b625ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786929E20", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1926-701e-00d7-7a60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "fd3164d1-a57d-49b2-bde7-523813b625ec" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "851f00db-c270-4957-b172-51b93a35d344", + "Content-Type" : "multipart/mixed; boundary=batch_b6fcbefd-72b2-49f0-850f-055fc6f933d8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1948-701e-00d7-1a60-b47a51000000", + "Body" : "--batchresponse_15fa3f3f-4f8e-4345-b892-5a6b7509c271\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1948-701e-00d7-1a60-b47a511e9d11\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: fe3e2cb8-c589-4b64-95a0-8b07e712d93b\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1948-701e-00d7-1a60-b47a511e9d11\nTime:2019-12-16T22:30:16.7006281Z\r\n--batchresponse_15fa3f3f-4f8e-4345-b892-5a6b7509c271\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1948-701e-00d7-1a60-b47a511e9d13\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 21395ca7-f88e-497c-9e50-6b4c709f2043\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_15fa3f3f-4f8e-4345-b892-5a6b7509c271--", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "851f00db-c270-4957-b172-51b93a35d344", + "Content-Type" : "multipart/mixed; boundary=batchresponse_15fa3f3f-4f8e-4345-b892-5a6b7509c271" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dd28fa8a-615a-4463-a335-19db700019cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb196b-701e-00d7-3660-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0775660d9d61ddf7d14Mon, 16 Dec 2019 22:30:16 GMT\"0x8D7827786887C8C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes131852ca629d0bf04c4Mon, 16 Dec 2019 22:30:16 GMT\"0x8D78277868D5FBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "dd28fa8a-615a-4463-a335-19db700019cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0775660d9d61ddf7d14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e318e848-cf9b-448e-82b1-109c0167aa4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb197c-701e-00d7-4660-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "e318e848-cf9b-448e-82b1-109c0167aa4e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes131852ca629d0bf04c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b6af04ce-2ee4-4262-8b30-e8faec09ae0e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb199b-701e-00d7-6560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:15 GMT", + "x-ms-client-request-id" : "b6af04ce-2ee4-4262-8b30-e8faec09ae0e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0775660d9d61ddf7d14", "jtcsubmittingsamebatchmanytimes131852ca629d0bf04c4", "javablobsubmittingsamebatchmanytimes263326bc5fb4606d", "javablobsubmittingsamebatchmanytimes31684051cf18ae55" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[6].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[6].json new file mode 100644 index 000000000000..9b1c7d2017fa --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[6].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes003187f796894940484?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "13f51f2d-5b20-430c-8679-89d072ef4518" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786B47913", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb19c6-701e-00d7-0f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "13f51f2d-5b20-430c-8679-89d072ef4518" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes111468f72c73d327f04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "cb68794a-5629-48cb-bc37-62ac884a6187" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786BA1FBF", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb19fa-701e-00d7-3e60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "cb68794a-5629-48cb-bc37-62ac884a6187" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes111468f72c73d327f04/javablobsubmittingsamebatchmanytimes3780594245ac8d3e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dfa063e9-ac7d-4b2f-a0eb-339926adb64d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786C2E1C3", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1a18-701e-00d7-5960-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "dfa063e9-ac7d-4b2f-a0eb-339926adb64d" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3d7f7acb-5a42-401c-b116-898c669a94eb", + "Content-Type" : "multipart/mixed; boundary=batch_a407b3c5-b1e9-4c36-83c3-91da0eef671f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1a3d-701e-00d7-7d60-b47a51000000", + "Body" : "--batchresponse_33049154-cf00-4883-9f9c-6707f8d1b6f4\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1a3d-701e-00d7-7d60-b47a511e9d1e\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 4715255e-f947-4407-8728-3343a3cc06bf\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1a3d-701e-00d7-7d60-b47a511e9d1e\nTime:2019-12-16T22:30:17.0189247Z\r\n--batchresponse_33049154-cf00-4883-9f9c-6707f8d1b6f4\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1a3d-701e-00d7-7d60-b47a511e9d20\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 7e19f752-88e8-41aa-9d60-2ff902de605c\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_33049154-cf00-4883-9f9c-6707f8d1b6f4--", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "3d7f7acb-5a42-401c-b116-898c669a94eb", + "Content-Type" : "multipart/mixed; boundary=batchresponse_33049154-cf00-4883-9f9c-6707f8d1b6f4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "401cae14-a179-400c-8182-31283f309c9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1a5c-701e-00d7-1b60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes003187f796894940484Mon, 16 Dec 2019 22:30:16 GMT\"0x8D7827786B47913\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes111468f72c73d327f04Mon, 16 Dec 2019 22:30:16 GMT\"0x8D7827786BA1FBF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "401cae14-a179-400c-8182-31283f309c9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes003187f796894940484?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "03295328-c368-4f08-9b45-2fbab9aa8695" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1a96-701e-00d7-5260-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "03295328-c368-4f08-9b45-2fbab9aa8695" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes111468f72c73d327f04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "b3f68820-72ae-4704-8b68-42ccf411196c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1ada-701e-00d7-1560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "b3f68820-72ae-4704-8b68-42ccf411196c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes003187f796894940484", "jtcsubmittingsamebatchmanytimes111468f72c73d327f04", "javablobsubmittingsamebatchmanytimes238931f0397b391d", "javablobsubmittingsamebatchmanytimes3780594245ac8d3e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[7].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[7].json new file mode 100644 index 000000000000..b1ae050c3394 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[7].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0106172a074033ed824?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d766fee5-ce91-4f60-b10f-948d74d2976d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786E8DC05", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1b0f-701e-00d7-4560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "d766fee5-ce91-4f60-b10f-948d74d2976d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1790897a41d73108284?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "50e82b12-0684-4fa2-81c4-53832b9a33c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786EE347A", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1b2a-701e-00d7-5b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "50e82b12-0684-4fa2-81c4-53832b9a33c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1790897a41d73108284/javablobsubmittingsamebatchmanytimes3338034a1146ea40", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f85d0854-a94c-4201-835c-475d2cc208b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827786F3C1D6", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1b52-701e-00d7-7e60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "f85d0854-a94c-4201-835c-475d2cc208b6" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7ce02f91-9757-4cdb-b63c-249c9b27163e", + "Content-Type" : "multipart/mixed; boundary=batch_e80cf21c-6942-4a9c-a781-37e88957bb7f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1b74-701e-00d7-1f60-b47a51000000", + "Body" : "--batchresponse_86e4d70c-f0c0-4e70-b9e5-3c4886e944f0\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1b74-701e-00d7-1f60-b47a511e9d2a\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 6b88180c-bee0-4494-941b-2086d1caa84b\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1b74-701e-00d7-1f60-b47a511e9d2a\nTime:2019-12-16T22:30:17.3392232Z\r\n--batchresponse_86e4d70c-f0c0-4e70-b9e5-3c4886e944f0\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1b74-701e-00d7-1f60-b47a511e9d2c\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 32b1ebb8-0f5f-469b-ade3-456bfdd867d5\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_86e4d70c-f0c0-4e70-b9e5-3c4886e944f0--", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "7ce02f91-9757-4cdb-b63c-249c9b27163e", + "Content-Type" : "multipart/mixed; boundary=batchresponse_86e4d70c-f0c0-4e70-b9e5-3c4886e944f0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5edc37e7-d0d2-4d3f-8483-e82f51d35537" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1bac-701e-00d7-5160-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0106172a074033ed824Mon, 16 Dec 2019 22:30:17 GMT\"0x8D7827786E8DC05\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes1790897a41d73108284Mon, 16 Dec 2019 22:30:17 GMT\"0x8D7827786EE347A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "5edc37e7-d0d2-4d3f-8483-e82f51d35537", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0106172a074033ed824?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "082c9e94-79a6-4524-a3a1-15ea3bdb3c57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1bc8-701e-00d7-6c60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "082c9e94-79a6-4524-a3a1-15ea3bdb3c57" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1790897a41d73108284?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "cd5a3697-3b59-480d-9d3d-f750f788451a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1bd9-701e-00d7-7d60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "cd5a3697-3b59-480d-9d3d-f750f788451a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0106172a074033ed824", "jtcsubmittingsamebatchmanytimes1790897a41d73108284", "javablobsubmittingsamebatchmanytimes2699157646d13a03", "javablobsubmittingsamebatchmanytimes3338034a1146ea40" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[8].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[8].json new file mode 100644 index 000000000000..29daf7f298da --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[8].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0311208c7263bf3e264?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9189134d-a56d-423e-9158-ada4c1cdd165" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778711F1A4", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1bf7-701e-00d7-1b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "9189134d-a56d-423e-9158-ada4c1cdd165" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes109534b9843c96c24a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "6edb5f4b-05c8-4109-8552-ab435fa7bef9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D782778718AA03", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1c12-701e-00d7-3460-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "6edb5f4b-05c8-4109-8552-ab435fa7bef9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes109534b9843c96c24a4/javablobsubmittingsamebatchmanytimes3222321ed5c44594", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "92d0fc95-e366-41cf-a5a1-257216ef3340" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277871E85C2", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1c2d-701e-00d7-4a60-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "92d0fc95-e366-41cf-a5a1-257216ef3340" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "ada78b2b-2505-4894-9d2c-d08705ba59f3", + "Content-Type" : "multipart/mixed; boundary=batch_d82176ab-86d7-4cb4-bd59-cdd0235ebef0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1c58-701e-00d7-7260-b47a51000000", + "Body" : "--batchresponse_1d1cd4fe-7812-467a-982c-bd2c65082b6e\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1c58-701e-00d7-7260-b47a511e9d33\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 84bffa61-aacc-4c79-8f50-cef28f436252\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1c58-701e-00d7-7260-b47a511e9d33\nTime:2019-12-16T22:30:17.6475109Z\r\n--batchresponse_1d1cd4fe-7812-467a-982c-bd2c65082b6e\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1c58-701e-00d7-7260-b47a511e9d35\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: d128127b-0464-4a74-a8e3-c30dcb077507\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_1d1cd4fe-7812-467a-982c-bd2c65082b6e--", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "ada78b2b-2505-4894-9d2c-d08705ba59f3", + "Content-Type" : "multipart/mixed; boundary=batchresponse_1d1cd4fe-7812-467a-982c-bd2c65082b6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "445ad09b-9505-4120-89dd-d9d2212e3135" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1c72-701e-00d7-0960-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes0311208c7263bf3e264Mon, 16 Dec 2019 22:30:17 GMT\"0x8D782778711F1A4\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes109534b9843c96c24a4Mon, 16 Dec 2019 22:30:17 GMT\"0x8D782778718AA03\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "445ad09b-9505-4120-89dd-d9d2212e3135", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes0311208c7263bf3e264?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0b467abf-00bd-4268-a75f-217719d87eb8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1c8f-701e-00d7-2160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "0b467abf-00bd-4268-a75f-217719d87eb8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes109534b9843c96c24a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f803368e-369a-401b-accc-5468ce250289" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1ca3-701e-00d7-3560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "f803368e-369a-401b-accc-5468ce250289" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes0311208c7263bf3e264", "jtcsubmittingsamebatchmanytimes109534b9843c96c24a4", "javablobsubmittingsamebatchmanytimes2699402b47a473ed", "javablobsubmittingsamebatchmanytimes3222321ed5c44594" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[9].json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[9].json new file mode 100644 index 000000000000..ed9ea04258b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITestsubmittingsamebatchmanytimes[9].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes053146eac418cd02eb4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "45345c63-af00-46c6-ad1a-3ab2180fcc92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D78277873B7C91", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1cbd-701e-00d7-4b60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "45345c63-af00-46c6-ad1a-3ab2180fcc92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1738681b05e5142f524?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8ab3a7cc-3b5c-42e9-bbb2-0d7e911304ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787405FB7", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1cd3-701e-00d7-5f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "8ab3a7cc-3b5c-42e9-bbb2-0d7e911304ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1738681b05e5142f524/javablobsubmittingsamebatchmanytimes3575121abd5d0f81", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "08614d1a-f40c-47cb-a633-9ac23b6e7dde" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7827787455123", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8dbb1ced-701e-00d7-7460-b47a51000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 16 Dec 2019 22:30:16 GMT", + "x-ms-client-request-id" : "08614d1a-f40c-47cb-a633-9ac23b6e7dde" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d8a75472-ad2b-4a3f-b62a-4ea310cbb001", + "Content-Type" : "multipart/mixed; boundary=batch_11576b08-ae51-464f-9077-47c1d7b0b5b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1d05-701e-00d7-0c60-b47a51000000", + "Body" : "--batchresponse_826715a4-2314-4a39-ad26-031ad0e87795\r\nContent-Type: application/http\r\nContent-ID: 0\r\n\r\nHTTP/1.1 404 The specified blob does not exist.\r\nx-ms-error-code: BlobNotFound\r\nx-ms-request-id: 8dbb1d05-701e-00d7-0c60-b47a511e9d3d\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: 65f26a23-ad1f-4482-88f3-ce3f11ba73b1\r\nContent-Length: 216\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nBlobNotFoundThe specified blob does not exist.\nRequestId:8dbb1d05-701e-00d7-0c60-b47a511e9d3d\nTime:2019-12-16T22:30:17.8727218Z\r\n--batchresponse_826715a4-2314-4a39-ad26-031ad0e87795\r\nContent-Type: application/http\r\nContent-ID: 1\r\n\r\nHTTP/1.1 202 Accepted\r\nx-ms-delete-type-permanent: true\r\nx-ms-request-id: 8dbb1d05-701e-00d7-0c60-b47a511e9d3f\r\nx-ms-version: 2019-02-02\r\nx-ms-client-request-id: c1f14726-4a98-4d53-8921-87cdad07f8d9\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n--batchresponse_826715a4-2314-4a39-ad26-031ad0e87795--", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "d8a75472-ad2b-4a3f-b62a-4ea310cbb001", + "Content-Type" : "multipart/mixed; boundary=batchresponse_826715a4-2314-4a39-ad26-031ad0e87795" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsubmittingsamebatchmanytimes&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "178738ce-f9e9-4426-880b-7c1644712721" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8dbb1d19-701e-00d7-1e60-b47a51000000", + "Body" : "jtcsubmittingsamebatchmanytimesjtcsubmittingsamebatchmanytimes053146eac418cd02eb4Mon, 16 Dec 2019 22:30:17 GMT\"0x8D78277873B7C91\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsubmittingsamebatchmanytimes1738681b05e5142f524Mon, 16 Dec 2019 22:30:17 GMT\"0x8D7827787405FB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "178738ce-f9e9-4426-880b-7c1644712721", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes053146eac418cd02eb4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a0248ebd-09d9-4f90-a65b-1d9689198b1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1d2c-701e-00d7-2f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "a0248ebd-09d9-4f90-a65b-1d9689198b1e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsubmittingsamebatchmanytimes1738681b05e5142f524?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f9d70995-4079-45eb-8c0a-c679d99aa9ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8dbb1d44-701e-00d7-4560-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:17 GMT", + "x-ms-client-request-id" : "f9d70995-4079-45eb-8c0a-c679d99aa9ba" + }, + "Exception" : null + } ], + "variables" : [ "jtcsubmittingsamebatchmanytimes053146eac418cd02eb4", "jtcsubmittingsamebatchmanytimes1738681b05e5142f524", "javablobsubmittingsamebatchmanytimes2492541b4d73d4d8", "javablobsubmittingsamebatchmanytimes3575121abd5d0f81" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITesttoomanyoperationsfails.json b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITesttoomanyoperationsfails.json index 3894f3c2a89b..4f5d37c570c0 100644 --- a/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITesttoomanyoperationsfails.json +++ b/sdk/storage/azure-storage-blob-batch/src/test/resources/session-records/BatchAPITesttoomanyoperationsfails.json @@ -1,23 +1,23 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtctoomanyoperationsfails0131552716b15271c44b31?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtctoomanyoperationsfails0621332f9e6247c6414a70?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-preview.1 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "585aba1f-1f01-45ef-98b6-3ab568f1f00d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "84eaeb33-d533-456f-ba62-bcc503e253b8" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D762419B6273D5", - "Last-Modified" : "Tue, 05 Nov 2019 22:43:41 GMT", + "ETag" : "0x8D782778505025F", + "Last-Modified" : "Mon, 16 Dec 2019 22:30:14 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "c2534a99-401e-0057-762a-94d9fb000000", - "Date" : "Tue, 05 Nov 2019 22:43:41 GMT", - "x-ms-client-request-id" : "585aba1f-1f01-45ef-98b6-3ab568f1f00d" + "x-ms-request-id" : "8dbb11c9-701e-00d7-3f60-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "84eaeb33-d533-456f-ba62-bcc503e253b8" }, "Exception" : null }, { @@ -25,9 +25,9 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=batch", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-preview.1 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "0186cda6-57e3-445c-8ca4-9bb060de923b", - "Content-Type" : "multipart/mixed; boundary=batch_83ce9faa-0770-4eba-93b2-6ef02b3f204e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "a1ba1633-e761-49bc-8990-e0732f09564a", + "Content-Type" : "multipart/mixed; boundary=batch_f41f7d95-34ea-48a5-a66e-4cbf2b1f68f8" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -35,11 +35,11 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "202", - "x-ms-request-id" : "8be854d6-f01e-0127-2f2a-94ec6a000000", - "Body" : "--batchresponse_ee2665df-1db3-4515-94e9-e2de33908719\r\nContent-Type: application/http\r\n\r\nHTTP/1.1 400 The batch operation exceeds maximum number of allowed subrequests.\r\nx-ms-error-code: ExceedsMaxBatchRequestCount\r\nx-ms-request-id: 8be854d6-f01e-0127-2f2a-94ec6a000000\r\nx-ms-version: 2019-02-02\r\nContent-Length: 263\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nExceedsMaxBatchRequestCountThe batch operation exceeds maximum number of allowed subrequests.\nRequestId:8be854d6-f01e-0127-2f2a-94ec6a000000\nTime:2019-11-05T22:43:41.8355006Z\r\n--batchresponse_ee2665df-1db3-4515-94e9-e2de33908719--", - "Date" : "Tue, 05 Nov 2019 22:43:41 GMT", - "x-ms-client-request-id" : "0186cda6-57e3-445c-8ca4-9bb060de923b", - "Content-Type" : "multipart/mixed; boundary=batchresponse_ee2665df-1db3-4515-94e9-e2de33908719" + "x-ms-request-id" : "8dbb134b-701e-00d7-2c60-b47a51000000", + "Body" : "--batchresponse_1a91d660-8e33-4f1c-b7d4-1f2403b09d06\r\nContent-Type: application/http\r\n\r\nHTTP/1.1 400 The batch operation exceeds maximum number of allowed subrequests.\r\nx-ms-error-code: ExceedsMaxBatchRequestCount\r\nx-ms-request-id: 8dbb134b-701e-00d7-2c60-b47a51000000\r\nx-ms-version: 2019-02-02\r\nContent-Length: 263\r\nContent-Type: application/xml\r\nServer: Windows-Azure-Blob/1.0\r\n\r\n\nExceedsMaxBatchRequestCountThe batch operation exceeds maximum number of allowed subrequests.\nRequestId:8dbb134b-701e-00d7-2c60-b47a51000000\nTime:2019-12-16T22:30:14.6747374Z\r\n--batchresponse_1a91d660-8e33-4f1c-b7d4-1f2403b09d06--", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "a1ba1633-e761-49bc-8990-e0732f09564a", + "Content-Type" : "multipart/mixed; boundary=batchresponse_1a91d660-8e33-4f1c-b7d4-1f2403b09d06" }, "Exception" : null }, { @@ -47,8 +47,8 @@ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtctoomanyoperationsfails&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-preview.1 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "3bca8aaa-3d58-45a8-9ef3-1a5d87441506" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "0c00725e-2c38-4a88-ac24-90c995ccb80e" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -56,20 +56,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "c2534b63-401e-0057-242a-94d9fb000000", - "Body" : "jtctoomanyoperationsfailsjtctoomanyoperationsfails0131552716b15271c44b31Tue, 05 Nov 2019 22:43:41 GMT\"0x8D762419B6273D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Tue, 05 Nov 2019 22:43:41 GMT", - "x-ms-client-request-id" : "3bca8aaa-3d58-45a8-9ef3-1a5d87441506", + "x-ms-request-id" : "8dbb1378-701e-00d7-5660-b47a51000000", + "Body" : "jtctoomanyoperationsfailsjtctoomanyoperationsfails0621332f9e6247c6414a70Mon, 16 Dec 2019 22:30:14 GMT\"0x8D782778505025F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "0c00725e-2c38-4a88-ac24-90c995ccb80e", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtctoomanyoperationsfails0131552716b15271c44b31?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtctoomanyoperationsfails0621332f9e6247c6414a70?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-preview.1 11.0.4; Windows 10 10.0", - "x-ms-client-request-id" : "625e70ab-0e07-4424-83dd-5c032fc465f8" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "890a4b76-2ef1-476e-b202-509b2c3783a6" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -77,11 +77,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "8be854f5-f01e-0127-4a2a-94ec6a000000", - "Date" : "Tue, 05 Nov 2019 22:43:41 GMT", - "x-ms-client-request-id" : "625e70ab-0e07-4424-83dd-5c032fc465f8" + "x-ms-request-id" : "8dbb1384-701e-00d7-6160-b47a51000000", + "Date" : "Mon, 16 Dec 2019 22:30:13 GMT", + "x-ms-client-request-id" : "890a4b76-2ef1-476e-b202-509b2c3783a6" }, "Exception" : null } ], - "variables" : [ "jtctoomanyoperationsfails0131552716b15271c44b31", "javablobtoomanyoperationsfails1547234c8d524320324", "javablobtoomanyoperationsfails227635f39622b591294", "javablobtoomanyoperationsfails3544933af78f0a5c984", "javablobtoomanyoperationsfails485531e5b9b9dae5a04", "javablobtoomanyoperationsfails578829b056e7ade9944", "javablobtoomanyoperationsfails63696292ca17616f1c4", "javablobtoomanyoperationsfails72523116c03a3b75534", "javablobtoomanyoperationsfails889220b77560425bd24", "javablobtoomanyoperationsfails968076e14261e705304", "javablobtoomanyoperationsfails105117461644e2da5a84", "javablobtoomanyoperationsfails1151400d6603bec53204", "javablobtoomanyoperationsfails12072554de74cc411f54", "javablobtoomanyoperationsfails13831995466f39bed884", "javablobtoomanyoperationsfails1464678c6a9f139ab2a4", "javablobtoomanyoperationsfails15889445bcf63d8a36c4", "javablobtoomanyoperationsfails163487407180fa3e05b4", "javablobtoomanyoperationsfails17007521fc007179bfe4", "javablobtoomanyoperationsfails1865734b9359561f41b4", "javablobtoomanyoperationsfails1959729907d0032d45b4", "javablobtoomanyoperationsfails2016472439bca89fa9b4", "javablobtoomanyoperationsfails21847934412db099cfe4", "javablobtoomanyoperationsfails2233752b7f71011ee554", "javablobtoomanyoperationsfails2396868aca8d39b17ff4", "javablobtoomanyoperationsfails24724442ff4f10c80124", "javablobtoomanyoperationsfails25093148b859709fb724", "javablobtoomanyoperationsfails26579188b36b10650114", "javablobtoomanyoperationsfails27256780044157de2a94", "javablobtoomanyoperationsfails288285675127fa683bf4", "javablobtoomanyoperationsfails299704933fcd45108004", "javablobtoomanyoperationsfails30903004fbac947b2f14", "javablobtoomanyoperationsfails313060357ded143eed24", "javablobtoomanyoperationsfails3234545c764b20bcc0d4", "javablobtoomanyoperationsfails3345993329a0013c7134", "javablobtoomanyoperationsfails3434656a584ad48b8e04", "javablobtoomanyoperationsfails35844662e9fb17525c14", "javablobtoomanyoperationsfails3606031439ec1b1fc954", "javablobtoomanyoperationsfails37639956174495828454", "javablobtoomanyoperationsfails3869414c775db74d0164", "javablobtoomanyoperationsfails39018551db6760578784", "javablobtoomanyoperationsfails4061174bacd8a851a954", "javablobtoomanyoperationsfails41826388ac8a35f82ff4", "javablobtoomanyoperationsfails421820945e3aef9a5894", "javablobtoomanyoperationsfails430778877c2665d1c124", "javablobtoomanyoperationsfails440714724ebd55e4eb64", "javablobtoomanyoperationsfails4597966392caf6c19e64", "javablobtoomanyoperationsfails46073888f521de3282b4", "javablobtoomanyoperationsfails47366033bbe6150b61e4", "javablobtoomanyoperationsfails4855067df8a725dc95e4", "javablobtoomanyoperationsfails496415115cff5d998374", "javablobtoomanyoperationsfails5012626a3fd8879388a4", "javablobtoomanyoperationsfails513070255ae689163294", "javablobtoomanyoperationsfails52958021fb20b387afa4", "javablobtoomanyoperationsfails533830237dce32144704", "javablobtoomanyoperationsfails5402032ba78ced5dfd44", "javablobtoomanyoperationsfails55166914a333c3beb9f4", "javablobtoomanyoperationsfails5605174d015aee909a14", "javablobtoomanyoperationsfails5750114ebb4e42ac2214", "javablobtoomanyoperationsfails5834357c9e8d78f6abd4", "javablobtoomanyoperationsfails59546572ea7595339414", "javablobtoomanyoperationsfails602476592fa411fbc6c4", "javablobtoomanyoperationsfails6116198e481b28f8a5b4", "javablobtoomanyoperationsfails62372398cc6a318c62d4", "javablobtoomanyoperationsfails6360743450ea52baaf34", "javablobtoomanyoperationsfails64550247674e434f2c44", "javablobtoomanyoperationsfails6538287965f09448be44", "javablobtoomanyoperationsfails6680112bf7e294bdeee4", "javablobtoomanyoperationsfails675371321107c66249a4", "javablobtoomanyoperationsfails68572813070d5bbba5a4", "javablobtoomanyoperationsfails690451094da83e6d2394", "javablobtoomanyoperationsfails70890009a87fb7320d94", "javablobtoomanyoperationsfails7158927f79769fa95194", "javablobtoomanyoperationsfails723405748277b72345f4", "javablobtoomanyoperationsfails7393326dd3179447a664", "javablobtoomanyoperationsfails741963440144420f41c4", "javablobtoomanyoperationsfails75235206eb6e5b5f8cf4", "javablobtoomanyoperationsfails76366960d77fae1f2714", "javablobtoomanyoperationsfails77943058c3ee28511724", "javablobtoomanyoperationsfails78284704bc548174ef74", "javablobtoomanyoperationsfails7980331722d6032e6e94", "javablobtoomanyoperationsfails807636401d2547a7f6c4", "javablobtoomanyoperationsfails819779006c71e7b32594", "javablobtoomanyoperationsfails8276013341b337f175f4", "javablobtoomanyoperationsfails837286651dceef963914", "javablobtoomanyoperationsfails84050679c9d92fa1a284", "javablobtoomanyoperationsfails85292680760ef00a5ce4", "javablobtoomanyoperationsfails8645437f8c6642147814", "javablobtoomanyoperationsfails87183881561edbffe334", "javablobtoomanyoperationsfails88533982387d38cd2054", "javablobtoomanyoperationsfails8911231858ac58c7f1f4", "javablobtoomanyoperationsfails90397664750205099924", "javablobtoomanyoperationsfails9165592ce7ea88516514", "javablobtoomanyoperationsfails9202936bc0d93d5a6694", "javablobtoomanyoperationsfails9343824161e170883a44", "javablobtoomanyoperationsfails9414290907ed24dc7e24", "javablobtoomanyoperationsfails9561235d9051b47dfd24", "javablobtoomanyoperationsfails9623754c907939d5aad4", "javablobtoomanyoperationsfails97771483808694650bb4", "javablobtoomanyoperationsfails9888732c883cff372bd4", "javablobtoomanyoperationsfails9916323e571f432657d4", "javablobtoomanyoperationsfails10046217a1698ca89ab8", "javablobtoomanyoperationsfails101461870decee27331f", "javablobtoomanyoperationsfails1021982697309356af4b", "javablobtoomanyoperationsfails10345627b873adb710be", "javablobtoomanyoperationsfails104003852f2a98bcaeed", "javablobtoomanyoperationsfails105006592579eb11bd92", "javablobtoomanyoperationsfails106150775db3b6b9ab50", "javablobtoomanyoperationsfails10799244300675e8e256", "javablobtoomanyoperationsfails108642795051cdfb728d", "javablobtoomanyoperationsfails109267878081f7ab2b0a", "javablobtoomanyoperationsfails11085932362ae645d006", "javablobtoomanyoperationsfails111694948f81732f3e82", "javablobtoomanyoperationsfails11289448c21da44a6907", "javablobtoomanyoperationsfails11378430c890c85075c5", "javablobtoomanyoperationsfails11420144f24b21816530", "javablobtoomanyoperationsfails1156813518ae29bd634d", "javablobtoomanyoperationsfails11601756431c6c156939", "javablobtoomanyoperationsfails11756297fd3fee3c763c", "javablobtoomanyoperationsfails11890264a1e4502c216a", "javablobtoomanyoperationsfails119010093d51da4937d7", "javablobtoomanyoperationsfails12013653bda84ab181d6", "javablobtoomanyoperationsfails12183829ab6d208e60e7", "javablobtoomanyoperationsfails122604703fdb7d7d4b48", "javablobtoomanyoperationsfails12338107094c5fefd040", "javablobtoomanyoperationsfails1245019216eee77fade3", "javablobtoomanyoperationsfails12509332764a2ae3ac24", "javablobtoomanyoperationsfails12681492e54419527b8b", "javablobtoomanyoperationsfails12726474b17652b60f77", "javablobtoomanyoperationsfails12871875cfa87d9e4a5d", "javablobtoomanyoperationsfails129919234657d60b469b", "javablobtoomanyoperationsfails13084060edaae6d68efa", "javablobtoomanyoperationsfails131865406192217bafdd", "javablobtoomanyoperationsfails13210490077af11cfd34", "javablobtoomanyoperationsfails13395657d1f990171c27", "javablobtoomanyoperationsfails1346097061b2fceb8523", "javablobtoomanyoperationsfails13503242c830acf97720", "javablobtoomanyoperationsfails13698433e0960da91413", "javablobtoomanyoperationsfails1378541494ad71533a13", "javablobtoomanyoperationsfails1388788754d63ebc17da", "javablobtoomanyoperationsfails1398770471272c9724d9", "javablobtoomanyoperationsfails1403776232c635a84950", "javablobtoomanyoperationsfails14195173ed649f1f927e", "javablobtoomanyoperationsfails142781362958acecca1e", "javablobtoomanyoperationsfails143817391a5759cffe89", "javablobtoomanyoperationsfails144034723873e166478d", "javablobtoomanyoperationsfails14555953ad1757a5878b", "javablobtoomanyoperationsfails146973315a75688c6974", "javablobtoomanyoperationsfails147454542512171b24d2", "javablobtoomanyoperationsfails148715894f06dfd20210", "javablobtoomanyoperationsfails149077300f4015bd6f96", "javablobtoomanyoperationsfails150677831d495153014d", "javablobtoomanyoperationsfails15106345eaacbfc5ba33", "javablobtoomanyoperationsfails152237136f9c9bd8cccd", "javablobtoomanyoperationsfails15361927be4fd94f07a8", "javablobtoomanyoperationsfails15463927c77207fa78be", "javablobtoomanyoperationsfails1558590165c245b54c58", "javablobtoomanyoperationsfails15636685d7481b0bff25", "javablobtoomanyoperationsfails1577251488f30ae6417e", "javablobtoomanyoperationsfails15898715c439c8eb5aee", "javablobtoomanyoperationsfails159506503eae3a757f92", "javablobtoomanyoperationsfails16062948f53c432d262b", "javablobtoomanyoperationsfails16123298fd929a34a2fe", "javablobtoomanyoperationsfails16270472b1df0fd66847", "javablobtoomanyoperationsfails16340011505977934937", "javablobtoomanyoperationsfails1643832248a10b8d9b0b", "javablobtoomanyoperationsfails16555165d82fbfc2a01d", "javablobtoomanyoperationsfails16665784f86ab37c1e33", "javablobtoomanyoperationsfails167407101e0b0b62ceaf", "javablobtoomanyoperationsfails168761767dcabd2765a7", "javablobtoomanyoperationsfails1696753508e1e56952b6", "javablobtoomanyoperationsfails17099632453efe3dc57b", "javablobtoomanyoperationsfails17126452dce4f7c3a04f", "javablobtoomanyoperationsfails17271289d3d8ac377184", "javablobtoomanyoperationsfails17331058e288c16021e0", "javablobtoomanyoperationsfails17442712aa7c5ccb6085", "javablobtoomanyoperationsfails17545684b5109fd93ef4", "javablobtoomanyoperationsfails176347560f3cc5a9d72e", "javablobtoomanyoperationsfails17783591ffb011c37e64", "javablobtoomanyoperationsfails17823923a245429a5b38", "javablobtoomanyoperationsfails179645044112e70b1c34", "javablobtoomanyoperationsfails18051114ceefb7825f71", "javablobtoomanyoperationsfails18173714a4b646aed70f", "javablobtoomanyoperationsfails18221173ef72b41f4263", "javablobtoomanyoperationsfails183133403089ec632a9c", "javablobtoomanyoperationsfails184167921ce9cd86dd78", "javablobtoomanyoperationsfails185500187b5616e01ca1", "javablobtoomanyoperationsfails1865075954233da9efb4", "javablobtoomanyoperationsfails18788986ec3cc8c1a2a6", "javablobtoomanyoperationsfails188964391561ed89dcd0", "javablobtoomanyoperationsfails18904613ce7354a77ae4", "javablobtoomanyoperationsfails1901543823fa537f77b9", "javablobtoomanyoperationsfails19111662d34eeb9ab6c4", "javablobtoomanyoperationsfails192577178bbf852bf8c2", "javablobtoomanyoperationsfails1935059610d6a700eaad", "javablobtoomanyoperationsfails1941444122bd0f177f88", "javablobtoomanyoperationsfails19537103b581f176a183", "javablobtoomanyoperationsfails19672697a423c70158e1", "javablobtoomanyoperationsfails1979119844686552b13b", "javablobtoomanyoperationsfails19894347a4c8c99727b7", "javablobtoomanyoperationsfails199034265e5a4281cccb", "javablobtoomanyoperationsfails20079547d04b1a0f1e6c", "javablobtoomanyoperationsfails20142763964e87f0ce6d", "javablobtoomanyoperationsfails20232055205e1b09c954", "javablobtoomanyoperationsfails203388635ffaf7f449ff", "javablobtoomanyoperationsfails204729375a0df65218c5", "javablobtoomanyoperationsfails205901612f795d623749", "javablobtoomanyoperationsfails20679404fb713c131bc6", "javablobtoomanyoperationsfails20798834f7b876620fd1", "javablobtoomanyoperationsfails20877564b4f0e35a3fa7", "javablobtoomanyoperationsfails2094390377a57d92eaeb", "javablobtoomanyoperationsfails21069545b71ff32e21cf", "javablobtoomanyoperationsfails21188336fe83da702347", "javablobtoomanyoperationsfails212693525d89b58e3575", "javablobtoomanyoperationsfails21376974220395cee128", "javablobtoomanyoperationsfails214632713399f7491078", "javablobtoomanyoperationsfails2157140699431004dc0a", "javablobtoomanyoperationsfails216639694a10402a4909", "javablobtoomanyoperationsfails2172388314e0f69ade74", "javablobtoomanyoperationsfails21843870c757c76a8490", "javablobtoomanyoperationsfails219440998a0506db4f76", "javablobtoomanyoperationsfails22090982d2eb79e325b4", "javablobtoomanyoperationsfails22195425b50783c1eaf7", "javablobtoomanyoperationsfails222869021d87daf2bb4b", "javablobtoomanyoperationsfails223938685e2a1bacdd05", "javablobtoomanyoperationsfails22428830396cf16423cf", "javablobtoomanyoperationsfails225748679329f8a876cf", "javablobtoomanyoperationsfails226299507346d5a65604", "javablobtoomanyoperationsfails227002755c1447fdb9a7", "javablobtoomanyoperationsfails228280000a09a52486e3", "javablobtoomanyoperationsfails22945970ead08744a390", "javablobtoomanyoperationsfails23051847b810839b9414", "javablobtoomanyoperationsfails23168804cdcd8bf45c7e", "javablobtoomanyoperationsfails232125206e4d1daff027", "javablobtoomanyoperationsfails233180486a6c06ddae15", "javablobtoomanyoperationsfails2348032165fb074a68ea", "javablobtoomanyoperationsfails23556981c12756db302c", "javablobtoomanyoperationsfails236766366c7d0f1cadb9", "javablobtoomanyoperationsfails237379571a4b89a08760", "javablobtoomanyoperationsfails23858098b3e7d4a3aa8a", "javablobtoomanyoperationsfails239152625a76440e7b21", "javablobtoomanyoperationsfails24086560014936b7c549", "javablobtoomanyoperationsfails2419483098b0a70c98c6", "javablobtoomanyoperationsfails2426587990c8b003e619", "javablobtoomanyoperationsfails24368561d839af59ce8f", "javablobtoomanyoperationsfails244403334bc20a64491e", "javablobtoomanyoperationsfails24580551c28dc392ad2b", "javablobtoomanyoperationsfails24665977d8c5068009cd", "javablobtoomanyoperationsfails24705646790859aa816c", "javablobtoomanyoperationsfails248513561e2ed870d604", "javablobtoomanyoperationsfails2490023311c5ee5b77b6", "javablobtoomanyoperationsfails250307705f344f35da89", "javablobtoomanyoperationsfails2519494569d041ff059a", "javablobtoomanyoperationsfails25291533c6ea0cb142e2", "javablobtoomanyoperationsfails253592433a8eaec09e52", "javablobtoomanyoperationsfails254965390555f416a3e3", "javablobtoomanyoperationsfails25575193590eae2c5d8d", "javablobtoomanyoperationsfails2567581471cd6d456747", "javablobtoomanyoperationsfails25746242c7caf3d00e5d" ] + "variables" : [ "jtctoomanyoperationsfails0621332f9e6247c6414a70", "javablobtoomanyoperationsfails10656270b2c8494bd04", "javablobtoomanyoperationsfails280625c71f031b02f34", "javablobtoomanyoperationsfails323927ba8863530a114", "javablobtoomanyoperationsfails446396f11b69e8cbb04", "javablobtoomanyoperationsfails545826dae725fae1c64", "javablobtoomanyoperationsfails656033bc69a4d1f0aa4", "javablobtoomanyoperationsfails7338269326bac4b09e4", "javablobtoomanyoperationsfails80818533fb6462c22f4", "javablobtoomanyoperationsfails9961640f059db9ce3f4", "javablobtoomanyoperationsfails1031428c58683f7a66a4", "javablobtoomanyoperationsfails1148153e36803da56fa4", "javablobtoomanyoperationsfails124551790a09bc4e1944", "javablobtoomanyoperationsfails1328589511603d8ecc74", "javablobtoomanyoperationsfails142715304558f6994004", "javablobtoomanyoperationsfails157098080588bd9d66f4", "javablobtoomanyoperationsfails16868183ea1743ebf084", "javablobtoomanyoperationsfails17732099d9b8dadcee54", "javablobtoomanyoperationsfails1879710d963cd92c1014", "javablobtoomanyoperationsfails19335403e8175fa7e9a4", "javablobtoomanyoperationsfails20072377ef3b3430bd64", "javablobtoomanyoperationsfails2174723fd61c13531ed4", "javablobtoomanyoperationsfails225336590c05d7832aa4", "javablobtoomanyoperationsfails232532254297f592edc4", "javablobtoomanyoperationsfails24695794eb78f89f9234", "javablobtoomanyoperationsfails255061541583cfb7d6d4", "javablobtoomanyoperationsfails2655131817a95bbc5bf4", "javablobtoomanyoperationsfails2788829aee6bc591a3f4", "javablobtoomanyoperationsfails2824459f3076be17efa4", "javablobtoomanyoperationsfails294193669e3f06c0a634", "javablobtoomanyoperationsfails30363902d3ec1844aa34", "javablobtoomanyoperationsfails310176526c9507256f64", "javablobtoomanyoperationsfails322775086d38debd0184", "javablobtoomanyoperationsfails3336960998806f04a304", "javablobtoomanyoperationsfails3414355d92c9540dfaa4", "javablobtoomanyoperationsfails352951875812d04e38f4", "javablobtoomanyoperationsfails3619176eb801fbecf194", "javablobtoomanyoperationsfails3764083912e0ec8f27c4", "javablobtoomanyoperationsfails3845327aaceda3dc2b34", "javablobtoomanyoperationsfails3945124a56d34d43dbb4", "javablobtoomanyoperationsfails4001704e835a860c4494", "javablobtoomanyoperationsfails419205457b990d6b6484", "javablobtoomanyoperationsfails425167432d78474055b4", "javablobtoomanyoperationsfails4323081ab7a121798484", "javablobtoomanyoperationsfails4445935e97bab8ad1414", "javablobtoomanyoperationsfails45305429e0293519e424", "javablobtoomanyoperationsfails4608636a3b3500a1e7a4", "javablobtoomanyoperationsfails47363788696af5fce5f4", "javablobtoomanyoperationsfails4888520e59675af10574", "javablobtoomanyoperationsfails4901288166cd8a65ce14", "javablobtoomanyoperationsfails5035674818ae89226224", "javablobtoomanyoperationsfails51311799a90f7c7fd2c4", "javablobtoomanyoperationsfails52140232f94f57c18a24", "javablobtoomanyoperationsfails53945255021323a50b04", "javablobtoomanyoperationsfails5422009ea2ee6d994ef4", "javablobtoomanyoperationsfails5570279daf16a01e2f94", "javablobtoomanyoperationsfails565351722aa9cdcea0c4", "javablobtoomanyoperationsfails5754155900873b3efcd4", "javablobtoomanyoperationsfails58383716047857cd97f4", "javablobtoomanyoperationsfails598608612007b7b17ec4", "javablobtoomanyoperationsfails6079782d1110961f42c4", "javablobtoomanyoperationsfails6128338430b9ae048e14", "javablobtoomanyoperationsfails6285737829d2a5054bd4", "javablobtoomanyoperationsfails63990409f651eff4d624", "javablobtoomanyoperationsfails64997019def69c206954", "javablobtoomanyoperationsfails650944197ba4102411e4", "javablobtoomanyoperationsfails667682941d7259a2d634", "javablobtoomanyoperationsfails6747465abb45a6821104", "javablobtoomanyoperationsfails68780444d288869936a4", "javablobtoomanyoperationsfails6941130672abde83f464", "javablobtoomanyoperationsfails703629665dea296c27b4", "javablobtoomanyoperationsfails7174605c2a81c739ba94", "javablobtoomanyoperationsfails7249197edd696882e044", "javablobtoomanyoperationsfails7346795f4fe67d5b9374", "javablobtoomanyoperationsfails7479393545339d822a34", "javablobtoomanyoperationsfails7594283a41eca43bf094", "javablobtoomanyoperationsfails76690712ee56b63960f4", "javablobtoomanyoperationsfails7796301b79b55a74ba74", "javablobtoomanyoperationsfails783915562425286822f4", "javablobtoomanyoperationsfails7957432e2e85538a93e4", "javablobtoomanyoperationsfails8045355f4e93ee3bbe94", "javablobtoomanyoperationsfails8113859f46cc0d0fc924", "javablobtoomanyoperationsfails824717035eef4defaf24", "javablobtoomanyoperationsfails835497208f22dd5fb7b4", "javablobtoomanyoperationsfails843407605397f35138f4", "javablobtoomanyoperationsfails8513352bda2995509c84", "javablobtoomanyoperationsfails86158001d0405e7f77c4", "javablobtoomanyoperationsfails87952262f1749c4f7704", "javablobtoomanyoperationsfails8837516c3fad0fe8f1a4", "javablobtoomanyoperationsfails895418567b421a7076c4", "javablobtoomanyoperationsfails9088996b6c8a9daaf7d4", "javablobtoomanyoperationsfails916081732b8a50f52e94", "javablobtoomanyoperationsfails9216784a40eb53505ee4", "javablobtoomanyoperationsfails9314966eeefde0941d44", "javablobtoomanyoperationsfails9463918da5af64797e34", "javablobtoomanyoperationsfails953968994f5bafe9fdf4", "javablobtoomanyoperationsfails9660074ffda2abcf75b4", "javablobtoomanyoperationsfails97639497d45bcdc7ce04", "javablobtoomanyoperationsfails9876329f49e0abdbf2e4", "javablobtoomanyoperationsfails9992651e0b46385ff174", "javablobtoomanyoperationsfails10040423b79187cd890d", "javablobtoomanyoperationsfails10163908a6dc8491d2a9", "javablobtoomanyoperationsfails10240826a9e8065fbac3", "javablobtoomanyoperationsfails10374984feb045f74c4d", "javablobtoomanyoperationsfails1041749147240eaed6c6", "javablobtoomanyoperationsfails10547584fdbaf4347199", "javablobtoomanyoperationsfails1064281838f7fb492b5a", "javablobtoomanyoperationsfails1077479796dcf877b19c", "javablobtoomanyoperationsfails108695511996e582293f", "javablobtoomanyoperationsfails10936859671d390135dc", "javablobtoomanyoperationsfails110437245b16fa355b52", "javablobtoomanyoperationsfails11176478267b621aa272", "javablobtoomanyoperationsfails11245536f7177bda0bc3", "javablobtoomanyoperationsfails11382017037cbd54caf9", "javablobtoomanyoperationsfails11449922085228f67f43", "javablobtoomanyoperationsfails11515883e93c17ea2e13", "javablobtoomanyoperationsfails11665226d93fc7bcdb51", "javablobtoomanyoperationsfails11788262ef14fde40dba", "javablobtoomanyoperationsfails11834863a71e997c7786", "javablobtoomanyoperationsfails1193595802496937893f", "javablobtoomanyoperationsfails12090338aa5d4b813192", "javablobtoomanyoperationsfails121493890ed57557f51d", "javablobtoomanyoperationsfails12235064203bd798e2b3", "javablobtoomanyoperationsfails12306744d801540ce3b0", "javablobtoomanyoperationsfails1240372838fd8ecb0a67", "javablobtoomanyoperationsfails12503811c48b35685b71", "javablobtoomanyoperationsfails126201612c1c91461161", "javablobtoomanyoperationsfails12714401b4d2deff8198", "javablobtoomanyoperationsfails12888820e944f1b74278", "javablobtoomanyoperationsfails129257064801ee0e3c47", "javablobtoomanyoperationsfails1308705976ccaee8e0ff", "javablobtoomanyoperationsfails13125315df4931075b6e", "javablobtoomanyoperationsfails132167908a6837eb962b", "javablobtoomanyoperationsfails133687969c7741bdbebe", "javablobtoomanyoperationsfails13491776940c3c54d318", "javablobtoomanyoperationsfails13534844e9576bd53139", "javablobtoomanyoperationsfails136915205c528789c161", "javablobtoomanyoperationsfails1373523262f21cf2377b", "javablobtoomanyoperationsfails138017563fa0049a4031", "javablobtoomanyoperationsfails139793383b2308b23ef0", "javablobtoomanyoperationsfails140013046bf5a0655f5d", "javablobtoomanyoperationsfails1413473658f8ce93d223", "javablobtoomanyoperationsfails1427324734a732705ff4", "javablobtoomanyoperationsfails1431240469b80c6ded4e", "javablobtoomanyoperationsfails14441475fe01b9e7c4c8", "javablobtoomanyoperationsfails14580091e741e0f6e83a", "javablobtoomanyoperationsfails14651820be7337dd104b", "javablobtoomanyoperationsfails14718695232a6b5d10b7", "javablobtoomanyoperationsfails14837420278bed30e61e", "javablobtoomanyoperationsfails14969812e1d4a6180553", "javablobtoomanyoperationsfails150648260898317261db", "javablobtoomanyoperationsfails1517381147fb4a68b569", "javablobtoomanyoperationsfails15238928701e4f9efc6a", "javablobtoomanyoperationsfails1533364289d7e9942730", "javablobtoomanyoperationsfails154305261f262b197d5e", "javablobtoomanyoperationsfails15559602d301b5216ea1", "javablobtoomanyoperationsfails156321151a033c54839e", "javablobtoomanyoperationsfails15701374f6f2334115db", "javablobtoomanyoperationsfails1581122569b645247179", "javablobtoomanyoperationsfails159808721f6db8ef4585", "javablobtoomanyoperationsfails16030681d12c14a17cf3", "javablobtoomanyoperationsfails161974432833463644e2", "javablobtoomanyoperationsfails16239681714e4992c0f2", "javablobtoomanyoperationsfails16300523acdd020ba9d1", "javablobtoomanyoperationsfails164272852c52feeaabe6", "javablobtoomanyoperationsfails165260575b1e6bf46ace", "javablobtoomanyoperationsfails166630576324c0369f25", "javablobtoomanyoperationsfails1679946147c41f90f64d", "javablobtoomanyoperationsfails168847340bb20ba4e6a0", "javablobtoomanyoperationsfails16955907e47c650514d5", "javablobtoomanyoperationsfails170982554cffb1866ed5", "javablobtoomanyoperationsfails171786329ac05e2850bb", "javablobtoomanyoperationsfails17283188ac8d395f5201", "javablobtoomanyoperationsfails1732496619e89be5dceb", "javablobtoomanyoperationsfails17435933b4f3e813fbb5", "javablobtoomanyoperationsfails17563331485a5018dbf8", "javablobtoomanyoperationsfails1769520423950e529a40", "javablobtoomanyoperationsfails177831487d1277118868", "javablobtoomanyoperationsfails17878930db67a89562a3", "javablobtoomanyoperationsfails17990882ea043779514b", "javablobtoomanyoperationsfails180774946cab93b75496", "javablobtoomanyoperationsfails18180235b3f4fd9a7eec", "javablobtoomanyoperationsfails1828285437e0321a9895", "javablobtoomanyoperationsfails1833162131763f1bfe51", "javablobtoomanyoperationsfails1848858819b43a8c877b", "javablobtoomanyoperationsfails18564120adde4c8ae2c0", "javablobtoomanyoperationsfails186261852e91284ebfca", "javablobtoomanyoperationsfails187814177dad5508a9ec", "javablobtoomanyoperationsfails188167521f1cc2b2053e", "javablobtoomanyoperationsfails1897379862d1801e9414", "javablobtoomanyoperationsfails1909495948ab9bed4506", "javablobtoomanyoperationsfails191712837363c63e6ab9", "javablobtoomanyoperationsfails1926240727ff72937672", "javablobtoomanyoperationsfails193794546c98197ce45b", "javablobtoomanyoperationsfails19470881d16116a9a8df", "javablobtoomanyoperationsfails19520602a14eb564230d", "javablobtoomanyoperationsfails1962059243d4184e33a6", "javablobtoomanyoperationsfails19703985bae98941dfa8", "javablobtoomanyoperationsfails1989145096e032e08d8b", "javablobtoomanyoperationsfails1994223795874022e6f6", "javablobtoomanyoperationsfails200427531f7565e774c2", "javablobtoomanyoperationsfails20141218e8a75f7960e0", "javablobtoomanyoperationsfails2026497298bdb94d7b35", "javablobtoomanyoperationsfails20326810cad102059bd1", "javablobtoomanyoperationsfails2044562362c2ad34b9d3", "javablobtoomanyoperationsfails20527618234955696490", "javablobtoomanyoperationsfails20628591926661279229", "javablobtoomanyoperationsfails20733969cecf8505ddad", "javablobtoomanyoperationsfails20810452a329481cad6c", "javablobtoomanyoperationsfails20926483a10c234dcfff", "javablobtoomanyoperationsfails210954127895889c04fd", "javablobtoomanyoperationsfails211602736522c784042f", "javablobtoomanyoperationsfails2124504479be0dc651c9", "javablobtoomanyoperationsfails21310946a8ef777f55af", "javablobtoomanyoperationsfails2145016668a3df34b63b", "javablobtoomanyoperationsfails21506164061e46ec5b23", "javablobtoomanyoperationsfails2164666476f64a62d447", "javablobtoomanyoperationsfails21739154400af20d50a5", "javablobtoomanyoperationsfails218139091e45fb4b1173", "javablobtoomanyoperationsfails219273591087424235bf", "javablobtoomanyoperationsfails2209567908eb02e4ec5c", "javablobtoomanyoperationsfails22139148d4b70d4569af", "javablobtoomanyoperationsfails222966776381ab5dacf0", "javablobtoomanyoperationsfails2230018389bf4fb6e409", "javablobtoomanyoperationsfails22416947611b9de1cab4", "javablobtoomanyoperationsfails22514820135f5574383f", "javablobtoomanyoperationsfails22680733ef4a37ca467e", "javablobtoomanyoperationsfails22708266ee50840b222a", "javablobtoomanyoperationsfails2283887794ef0a033aa0", "javablobtoomanyoperationsfails22905308e449c0c68bf1", "javablobtoomanyoperationsfails2301301584a13609ab69", "javablobtoomanyoperationsfails23118538ce21eae66c86", "javablobtoomanyoperationsfails23254748baa0a784c685", "javablobtoomanyoperationsfails23397067437a3eac3c3a", "javablobtoomanyoperationsfails23461410a9c47e3642a1", "javablobtoomanyoperationsfails23520346d8c05d2a0d9a", "javablobtoomanyoperationsfails236115841020e082281d", "javablobtoomanyoperationsfails2372494462f355c5807c", "javablobtoomanyoperationsfails2380528017e2af69049b", "javablobtoomanyoperationsfails23943609d6f9a8be9ea2", "javablobtoomanyoperationsfails24071293d2315b3e5eae", "javablobtoomanyoperationsfails241152332c34aa346f6d", "javablobtoomanyoperationsfails24259436850179e48c0f", "javablobtoomanyoperationsfails24328084761f18d1ebad", "javablobtoomanyoperationsfails24438278cdf72848eb55", "javablobtoomanyoperationsfails24593170142ac4093d4d", "javablobtoomanyoperationsfails24643358eb199e492a08", "javablobtoomanyoperationsfails24747768a5b8d1a8cc63", "javablobtoomanyoperationsfails248435815cf5dc3b9cc4", "javablobtoomanyoperationsfails24934821b92ac87edb10", "javablobtoomanyoperationsfails25035409af66c505c5b9", "javablobtoomanyoperationsfails251207210a27185ea8b6", "javablobtoomanyoperationsfails25229368241f65a7bd5d", "javablobtoomanyoperationsfails2530114328696fc14d5d", "javablobtoomanyoperationsfails254615484151d7f073d5", "javablobtoomanyoperationsfails255435323b701c6e7f7e", "javablobtoomanyoperationsfails25603599eea3af234629", "javablobtoomanyoperationsfails2577327614e49f48b4c7" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md index 8c013e54395d..02268d916559 100644 --- a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md @@ -1,5 +1,8 @@ # Release History -## Version 12.1.0 (2019-12-04) + +## 12.2.0-beta.1 (Unreleased) + +## 12.1.0 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob-cryptography_12.1.0/sdk/storage/azure-storage-blob-cryptography/README.md) and @@ -9,7 +12,7 @@ and - Upgraded to version 1.1.0 of Azure Core. - Added a check in EncryptedBlobClientBuilder to enforce HTTPS for bearer token authentication. -## Version 12.0.0 (2019-10-31) +## 12.0.0 (2019-10-31) - Removed EncryptedBlobClientBuilder inheritance of BaseBlobClientBuilder ### Features included in `azure-storage-blob-cryptography` diff --git a/sdk/storage/azure-storage-blob-cryptography/README.md b/sdk/storage/azure-storage-blob-cryptography/README.md index bf82d86818e9..f41684ea4686 100644 --- a/sdk/storage/azure-storage-blob-cryptography/README.md +++ b/sdk/storage/azure-storage-blob-cryptography/README.md @@ -21,7 +21,7 @@ This package supports client side encryption for blob storage. com.azure azure-storage-blob-cryptography - 12.1.0 + 12.2.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -40,7 +40,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-storage-blob - 12.1.0 + 12.2.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml index a69927b10ff6..99992896009c 100644 --- a/sdk/storage/azure-storage-blob-cryptography/pom.xml +++ b/sdk/storage/azure-storage-blob-cryptography/pom.xml @@ -36,12 +36,12 @@ com.azure azure-storage-blob - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-blob-cryptography/src/test/java/com/azure/storage/blob/specialized/cryptography/APISpec.groovy b/sdk/storage/azure-storage-blob-cryptography/src/test/java/com/azure/storage/blob/specialized/cryptography/APISpec.groovy index e50e3ad98cfa..c52685549cba 100644 --- a/sdk/storage/azure-storage-blob-cryptography/src/test/java/com/azure/storage/blob/specialized/cryptography/APISpec.groovy +++ b/sdk/storage/azure-storage-blob-cryptography/src/test/java/com/azure/storage/blob/specialized/cryptography/APISpec.groovy @@ -114,6 +114,10 @@ class APISpec extends Specification { this.testName = fullTestName.substring(0, substringIndex) this.interceptorManager = new InterceptorManager(className + fullTestName, testMode) this.resourceNamer = new TestResourceNamer(className + testName, testMode, interceptorManager.getRecordedData()) + + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + // If the test doesn't have the Requires tag record it in live mode. recordLiveMode = specificationContext.getCurrentIteration().getDescription().getAnnotation(Requires.class) == null connectionString = Configuration.getGlobalConfiguration().get("AZURE_STORAGE_BLOB_CONNECTION_STRING") diff --git a/sdk/storage/azure-storage-blob-nio/CHANGELOG.md b/sdk/storage/azure-storage-blob-nio/CHANGELOG.md new file mode 100644 index 000000000000..972764e38a67 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/CHANGELOG.md @@ -0,0 +1,10 @@ +# Release History + +This package's +[documentation](LINK) +and +[samples](LINK) +demonstrate the new API. + +## 12.0.0-beta.1 (Unreleased) +- Initial Release. Please see the README and wiki for information on the new design. diff --git a/sdk/storage/azure-storage-blob-nio/README.md b/sdk/storage/azure-storage-blob-nio/README.md new file mode 100644 index 000000000000..870343ccd659 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/README.md @@ -0,0 +1,215 @@ +# Azure Storage Blob implementation of Java NIO +## This README is not yet updated for this project and is a skeleton copied from blobs + +[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][samples] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] +- [Create Storage Account][storage_account] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-storage-blob-nio;current}) +```xml + + com.azure + azure-storage-blob-nio + 12.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Default HTTP Client +All client libraries, by default, use the Netty HTTP client. Adding the above dependency will automatically configure +Storage Blob to use the Netty HTTP client. + +### Alternate HTTP client +If, instead of Netty it is preferable to use OkHTTP, there is an HTTP client available for that too. Exclude the default +Netty and include the OkHTTP client in your pom.xml. + +[//]: # ({x-version-update-start;com.azure:azure-storage-blob;current}) +```xml + + + com.azure + azure-storage-blob + 12.2.0-beta.2 + + + com.azure + azure-core-http-netty + + + +``` +[//]: # ({x-version-update-end}) +[//]: # ({x-version-update-start;com.azure:azure-core-http-okhttp;current}) +```xml + + + com.azure + azure-core-http-okhttp + 1.1.0 + +``` +[//]: # ({x-version-update-end}) + +### Configuring HTTP Clients +When an HTTP client is included on the classpath, as shown above, it is not necessary to specify it in the client library [builders](#create-blobserviceclient) unless you want to customize the HTTP client in some fashion. If this is desired, the `httpClient` builder method is often available to achieve just this by allowing users to provide custom (or customized) `com.azure.core.http.HttpClient` instances. + +For starters, by having the Netty or OkHTTP dependencies on your classpath, as shown above, you can create new instances of these `HttpClient` types using their builder APIs. For example, here is how you would create a Netty HttpClient instance: + +### Default SSL library +All client libraries, by default, use the Tomcat-native Boring SSL library to enable native-level performance for SSL operations. The Boring SSL library is an uber jar containing native libraries for Linux / macOS / Windows, and provides better performance compared to the default SSL implementation within the JDK. For more information, including how to reduce the dependency size, refer to the [performance tuning][performance_tuning] section of the wiki. + +```java +HttpClient client = new NettyAsyncHttpClientBuilder() + .port(8080) + .wiretap(true) + .build(); +``` + +### Create a Storage Account +To create a Storage Account you can use the [Azure Portal][storage_account_create_portal] or [Azure CLI][storage_account_create_cli]. + +```bash +az storage account create \ + --resource-group \ + --name \ + --location +``` + +### Authenticate the client + +In order to interact with the Storage Service (Blob, Queue, Message, MessageId, File) you'll need to create an instance of the Service Client class. +To make this possible you'll need the Account SAS (shared access signature) string of the Storage Account. Learn more at [SAS Token][sas_token] + +#### Get credentials + +##### SAS Token + +a. Use the Azure CLI snippet below to get the SAS token from the Storage Account. + +```bash +az storage blob generate-sas \ + --account-name {Storage Account name} \ + --container-name {container name} \ + --name {blob name} \ + --permissions {permissions to grant} \ + --expiry {datetime to expire the SAS token} \ + --services {storage services the SAS allows} \ + --resource-types {resource types the SAS allows} +``` + +Example: + +```bash +CONNECTION_STRING= + +az storage blob generate-sas \ + --account-name MyStorageAccount \ + --container-name MyContainer \ + --name MyBlob \ + --permissions racdw \ + --expiry 2020-06-15 +``` + +b. Alternatively, get the Account SAS Token from the Azure Portal. + +1. Go to your Storage Account +2. Select `Shared access signature` from the menu on the left +3. Click on `Generate SAS and connection string` (after setup) + +##### **Shared Key Credential** + +a. Use Account name and Account key. Account name is your Storage Account name. + +1. Go to your Storage Account +2. Select `Access keys` from the menu on the left +3. Under `key1`/`key2` copy the contents of the `Key` field + +or + +b. Use the connection string. + +1. Go to your Storage Account +2. Select `Access keys` from the menu on the left +3. Under `key1`/`key2` copy the contents of the `Connection string` field + +## Key concepts + +Blob Storage is designed for: + +- Serving images or documents directly to a browser +- Storing files for distributed access +- Streaming video and audio +- Writing to log files +- Storing data for backup and restore, disaster recovery, and archiving +- Storing data for analysis by an on-premises or Azure-hosted service + +## Examples + +The following sections provide several code snippets covering some of the most common Azure Storage Blob tasks, including: + +- [Create a `BlobServiceClient`](#create-a-blobserviceclient) + + +### Create a `BlobServiceClient` + +Create a `BlobServiceClient` using the [`sasToken`](#get-credentials) generated above. + +```java +BlobServiceClient blobServiceClient = new BlobServiceClientBuilder() + .endpoint("") + .sasToken("") + .buildClient(); +``` + + +## Troubleshooting + +When interacting with blobs using this Java client library, errors returned by the service correspond to the same HTTP +status codes returned for [REST API][error_codes] requests. For example, if you try to retrieve a container or blob that +doesn't exist in your Storage Account, a `404` error is returned, indicating `Not Found`. + +## Next steps + +Several Storage blob Java SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Key Vault: + +## Next steps Samples +Samples are explained in detail [here][samples_readme]. + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a [Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution. + +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 repos 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 [opencode@microsoft.com][coc_contact] with any additional questions or comments. + + +[source]: src +[samples_readme]: src/samples/README.md +[docs]: http://azure.github.io/azure-sdk-for-java/ +[rest_docs]: https://docs.microsoft.com/rest/api/storageservices/blob-service-rest-api +[product_docs]: https://docs.microsoft.com/azure/storage/blobs/storage-blobs-overview +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[storage_account_create_cli]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli +[storage_account_create_portal]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity/README.md +[error_codes]: https://docs.microsoft.com/rest/api/storageservices/blob-service-error-codes +[samples]: src/samples +[cla]: https://cla.microsoft.com +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com +[performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fstorage%2Fazure-storage-blob%2FREADME.png) diff --git a/sdk/storage/azure-storage-blob-nio/pom.xml b/sdk/storage/azure-storage-blob-nio/pom.xml new file mode 100644 index 000000000000..c7df33047ee5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/pom.xml @@ -0,0 +1,269 @@ + + + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../../pom.client.xml + + + 4.0.0 + + com.azure + azure-storage-blob-nio + 12.0.0-beta.1 + + Microsoft Azure implementation of NIO on top of Azure Blob Storage + This module contains an implementation of Java's NIO interface on top of Azure Blob Storage. + https://github.com/Azure/azure-sdk-for-java + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + src/main/java + src/test/java + + + + + bintray + Groovy Bintray + https://dl.bintray.com/groovy/maven + + never + + + false + + + + + + + com.azure + azure-storage-blob + 12.2.0-beta.1 + + + org.slf4j + slf4j-api + 1.7.28 + + + + com.azure + azure-core-test + 1.1.0-beta.2 + test + + + com.azure + azure-core-http-netty + 1.1.0 + test + + + com.azure + azure-identity + 1.0.1 + test + + + org.slf4j + slf4j-simple + 1.7.25 + test + + + io.projectreactor + reactor-test + 3.3.0.RELEASE + test + + + com.microsoft.azure + adal4j + 1.6.4 + test + + + org.spockframework + spock-core + 1.3-groovy-2.5 + test + + + cglib + cglib-nodep + 3.2.7 + test + + + + + src/main/java + src/test/java + + + ${basedir}/src/test/resources + + + + + + + java8 + + [1.8,9) + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + true + + -Xlint:all + -Xlint:-serial + -Xlint:-deprecation + -Xlint:-processing + + + module-info.java + + + + + + test-compile + process-test-sources + + testCompile + + + groovy-eclipse-compiler + -warn:-unused + + + + default-testCompile + process-test-sources + + testCompile + + + groovy-eclipse-compiler + -warn:-unused + + + + + + org.codehaus.groovy + groovy-eclipse-compiler + 3.4.0-01 + + + org.codehaus.groovy + groovy-eclipse-batch + 2.5.8-01 + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + + + + + java9plus + + [9,) + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 9 + 9 + + + + test-compile + process-test-sources + + testCompile + + + groovy-eclipse-compiler + -warn:-unused + 8 + + + + default-testCompile + process-test-sources + + testCompile + + + groovy-eclipse-compiler + -warn:-unused + 8 + + + + + + org.codehaus.groovy + groovy-eclipse-compiler + 3.4.0-01 + + + org.codehaus.groovy + groovy-eclipse-batch + 2.5.8-01 + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + + + + + + + + diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java new file mode 100644 index 000000000000..72e5dd611c69 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/AzureFileSystemProvider.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.nio; + +/** + * Empty class. + */ +public class AzureFileSystemProvider { + +} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/package-info.java b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/package-info.java new file mode 100644 index 000000000000..96cd1fbd6275 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/com/azure/storage/blob/nio/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing the classes for loading the AzureFileSystemProvider based on Azure Storage Blobs. + */ +package com.azure.storage.blob.nio; diff --git a/sdk/storage/azure-storage-blob-nio/src/main/java/module-info.java b/sdk/storage/azure-storage-blob-nio/src/main/java/module-info.java new file mode 100644 index 000000000000..58d95ad8f306 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +module com.azure.storage.blob.nio { + requires transitive com.azure.core; + requires transitive com.azure.storage.common; + requires com.azure.storage.blob; + requires com.fasterxml.jackson.dataformat.xml; + + exports com.azure.storage.blob.nio; + + opens com.azure.storage.blob.nio to + com.fasterxml.jackson.databind, + com.azure.core; +} diff --git a/sdk/storage/azure-storage-blob-nio/src/main/resources/META_INF/services/java.nio.file.spi.FileSystemProvider b/sdk/storage/azure-storage-blob-nio/src/main/resources/META_INF/services/java.nio.file.spi.FileSystemProvider new file mode 100644 index 000000000000..7d26d6d7a2f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/src/main/resources/META_INF/services/java.nio.file.spi.FileSystemProvider @@ -0,0 +1 @@ +main.java.com.azure.storage.nio.blob.AzureFileSystemProvider \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 699d9690e885..85bf9fb81d67 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,10 +1,17 @@ -# Change Log azure-storage-blob +# Release History -## Version XX.X.X (XXXX-XX-XX) +## 12.2.0-beta.2 (Unreleased) +- Added a field to ParallelTransferOptions that allows customers to configure the maximum size to upload in a single PUT. Data sizes larger than this value will be chunked and parallelized. +- Added overloads to downloadToFile to add the option to overwrite existing files. Default behavior is to not overwrite. +- Improved performance of BlockBlobOutputStream. +- Added overloads to BlockBlobClient.getBlobOutputStream to allow users to provide parallel transfer options, http headers, metadata, access tier, and request conditions. + + +## 12.2.0-beta.1 (2019-12-17) - Added SAS generation methods on clients to improve discoverability and convenience of sas. Deprecated setContainerName, setBlobName, setSnapshotId, generateSasQueryParameters methods on BlobServiceSasSignatureValues to direct users to using the methods added on clients. - Fixed a bug where Account SAS would not work when set on clients. -## Version 12.1.0 (2019-12-04) +## 12.1.0 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.1.0/sdk/storage/azure-storage-blob/README.md) and @@ -18,7 +25,7 @@ and - Added a check in ClientBuilders to enforce HTTPS for bearer token authentication. - Upgraded to version 1.1.0 of Azure Core. -## Version 12.0.0 (2019-10-31) +## 12.0.0 (2019-10-31) - Removed BaseBlobClientBuilder - Removed BlobClientBuilder, BlobContainerClientBuilder, BlobServiceClientBuilder, and SpecializedBlobClientBuilder inheritance of BaseBlobClientBuilder @@ -45,7 +52,7 @@ and - Added support for blob names with special characters - Changed return type for BlobClient.downloadWithProperties from Response to BlobDownloadResponse and BlobAsyncClient.downloadWithProperties from Mono>> to Mono -## Version 12.0.0-preview.4 (2019-10-8) +## 12.0.0-preview.4 (2019-10-8) For details on the Azure SDK for Java (October 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview4-java). This package's @@ -73,7 +80,7 @@ and - Removed SAS token generation APIs from clients, use BlobServiceSasSignatureValues to generate SAS tokens. - Removed `SASTokenCredential`, `SASTokenCredentialPolicy` and the corresponding `credential(SASTokenCredential)` method in client builder, and added sasToken(String) instead. -## Version 12.0.0-preview.3 (2019-09-10) +## 12.0.0-preview.3 (2019-09-10) For details on the Azure SDK for Java (September 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). - Added tracing telemetry on maximum overload API. @@ -97,7 +104,7 @@ and [samples](https://github.com/Azure/azure-sdk-for-java/blob/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob) demonstrate the new API. -## Version 12.0.0-preview.2 (2019-08-08) +## 12.0.0-preview.2 (2019-08-08) For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). - Renamed `StorageClient`, `StorageAsyncClient`, and `StorageClientBuilder` to `BlobServiceClient`, `BlobServiceAsyncClient`, and `BlobServiceClientBuilder`. @@ -117,7 +124,7 @@ and [samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.0.0-preview.2/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob) demonstrate the new API. -## Version 12.0.0-preview.1 (2019-06-28) +## 12.0.0-preview.1 (2019-06-28) Version 12.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). For details on the Azure SDK for Java (July 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview1-java). @@ -137,10 +144,10 @@ For details on the Azure SDK for Java (July 2019 Preview) release, you can refer - Client and pipeline configuration is now available via keyword arguments at both the client level. - Authentication using `azure-identity` credentials. -## 2019.04.30 Version 11.1.1 +## 11.1.1 (2019.04.30) - Upgraded to version 2.1.1 of the autorest-clientime which upgrades to a more secure version of jackson and fixes a NPE on unkown host errors. -## 2019.03.22 Version 11.0.0 +## 11.0.0 (2019.03.22) - Upgraded to version 2.1.0 of the autorest-clientruntime which includes several important fixes to mitigate a commonly-seen "Connection reset by peer" error and other similar bugs. - Support for 2018-11-09 REST version. Please see our REST API documentation and blogs for information about the related added features. - Added appendBlockFromURL method. A block may be created with another blob as its source. @@ -160,21 +167,21 @@ For details on the Azure SDK for Java (July 2019 Preview) release, you can refer - Added getUserDelegationKey to ServiceURL, the result of which can be used to generate a user-delegation SAS. - Made the max results field on listing responses Integer instead of int as it is an optional field only returned when specified in the request. -## 2019.02.15 Version 10.5.0 +## 10.5.0 (2019.02.15) - Added uploadFromNonReplayableFlowable to support uploading arbitrary data sources (like network streams) to a block blob. -## 2019.01.11 Version 10.4.0 +## 10.4.0 (2019.01.11) - Fixed a bug that caused errors when java.io.tempdir has no trailing separator. - Upgrade autorest-clientruntime dependency to include some bug fixes. -## 2018.11.19 Version 10.3.0 +## 10.3.0 (2018.11.19) - Added support for SLF4J. - Included default logging to log warnings and errors to the temp directory by default. - Fixed a bug in hierarchical listings that would sometimes return incomplete results. - Included the whole HTTP Request in log statements (except for sensitive authorization information, which is redacted). - Fixed a bug that made the request property on the response object always null. -## 2018.10.29 Version 10.2.0 +## 10.2.0 (2018.10.29) - Added overloads which only accept the required parameters. - Added CopyFromURL, which will do a synchronous server-side copy, meaning the service will not return an HTTP response until it has completed the copy. - Added support for IProgressReceiver in TransferManager operations. This parameter was previously ignored but is now supported. @@ -182,13 +189,13 @@ For details on the Azure SDK for Java (July 2019 Preview) release, you can refer - Fixed a bug that would cause downloading large files with the TransferManager to fail. - Fixed a bug in BlobURL.download() logic for setting up reliable download. This had the potential to download the wrong range when a download stream was retried. -## 2018.09.11 Version 10.1.0 +## 10.1.0 (2018.09.11) - Interfaces for helper types updated to be more consistent throughout the library. All types, with the exception of the options for pipeline factories, use a fluent pattern. - Removed RetryReader type as it's functionality was moved to be built into the DownloadResponse. RetryReaderOptions are now named DownloadRetryOptions. - Restructured the access conditions to be more logically adhere to their respective functions. - Added support for context parameter on each api to allow communication with the pipeline from the application level -## 2018.08.22 Version 10.0.4-rc +## 10.0.4-rc (2018.08.22) - Support for the 2017-11-09 REST version. Please see our REST api documentation and blogs for information about the related added features. - Support for 2018-03-28 REST version. Please see our REST api documentation and blogs for information about the related added features. - Support for the getAccountInfo api on ServiceURL, ContainerURL, and BlobURL. @@ -201,10 +208,10 @@ For details on the Azure SDK for Java (July 2019 Preview) release, you can refer - Fixed retry policy. - Fixed logging policy. -## 2018.08.08 Version 10.0.3-Preview +## 10.0.3-Preview (2018.08.08) - Resolved dependency issues -## 2018.08.07 Version 10.0.2-Preview +## 10.0.2-Preview (2018.08.07) - Support for 2017-07-29 REST version. Please see our REST api documentation and blogs for information about the related added features. - Support for setting a block blob's tier. - Added support for soft delete feature. If a delete retention policy is enabled through the set service properties API, then blobs or snapshots can be deleted softly and retained for a specified number of days, before being permanently removed by garbage collection. @@ -213,7 +220,7 @@ For details on the Azure SDK for Java (July 2019 Preview) release, you can refer - BlockBlobURL.MAX_PUT_BLOCK_BYTES renamed to BlockBlobURL.MAX_STAGE_BLOCK_BYTES. - Changed the accessConditions parameter to be HTTPAccessConditions instead of BlobAccessConditions, since only http access conditions are supported. -## 2018.07.03 Version 10.0.1-Preview +## 10.0.1-Preview (2018.07.03) - Added the RetryReader class to allow for more reliable streaming on large downloads. This is now the return type of blobURL.download - Fixed a bug that caused generation of signatures to fail at high levels of parallelism. - Created the StorageException type to give easy access to the ErrorCode, StatusCode, and Message as available for unsuccessful responses. @@ -228,5 +235,5 @@ For details on the Azure SDK for Java (July 2019 Preview) release, you can refer - Fixed a bug that prevented proper reset of body stream upon retry. - Updated the defaults for RequestRetryOptions. -## 2018.04.27 Version 10.0.0-preview +## 10.0.0-preview (2018.04.27) - Initial Release. Please see the README and wiki for information on the new design. diff --git a/sdk/storage/azure-storage-blob/README.md b/sdk/storage/azure-storage-blob/README.md index ac052bbf4e12..41b9c0cbca05 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -22,7 +22,7 @@ definition, such as text or binary data. com.azure azure-storage-blob - 12.1.0 + 12.2.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -41,7 +41,7 @@ Netty and include the OkHTTP client in your pom.xml. com.azure azure-storage-blob - 12.1.0 + 12.2.0-beta.2 com.azure diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index c63cd8296fb4..ee71483c1407 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob - 12.2.0-beta.1 + 12.2.0-beta.2 Microsoft Azure client library for Blob Storage This module contains client library for Microsoft Azure Blob Storage. @@ -55,12 +55,12 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 com.azure azure-storage-common - 12.2.0-beta.1 + 12.2.0-beta.2 org.slf4j @@ -81,7 +81,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index 0450df7d194d..de7a3dc42655 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -72,8 +72,6 @@ * Docs for more information. */ public class BlobAsyncClient extends BlobAsyncClientBase { - private static final int CHUNKED_UPLOAD_REQUIREMENT = 4 * Constants.MB; - /** * The block size to use if none is specified in parallel operations. */ @@ -325,7 +323,8 @@ public Mono> uploadWithResponse(Flux data, .addProgressReporting(stream, validatedParallelTransferOptions.getProgressReceiver()), length, headers, metadata, tier, null, validatedRequestConditions); - return determineUploadFullOrChunked(data, uploadInChunksFunction, uploadFullBlobMethod); + return determineUploadFullOrChunked(data, validatedParallelTransferOptions, uploadInChunksFunction, + uploadFullBlobMethod); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -392,6 +391,7 @@ as we can guarantee we only need at most two buffers for any call to write (two } private Mono> determineUploadFullOrChunked(final Flux data, + ParallelTransferOptions parallelTransferOptions, final Function, Mono>> uploadInChunks, final BiFunction, Long, Mono>> uploadFullBlob) { final long[] bufferedDataSize = {0}; @@ -408,12 +408,12 @@ private Mono> determineUploadFullOrChunked(final Flux { - if (bufferedDataSize[0] > CHUNKED_UPLOAD_REQUIREMENT) { + if (bufferedDataSize[0] > parallelTransferOptions.getMaxSingleUploadSize()) { return false; } else { bufferedDataSize[0] += buffer.remaining(); - if (bufferedDataSize[0] > CHUNKED_UPLOAD_REQUIREMENT) { + if (bufferedDataSize[0] > parallelTransferOptions.getMaxSingleUploadSize()) { return true; } else { /* @@ -428,13 +428,13 @@ private Mono> determineUploadFullOrChunked(final Flux { @@ -500,7 +500,7 @@ public Mono uploadFromFile(String filePath, boolean overwrite) { // Note that if the file will be uploaded using a putBlob, we also can skip the exists check. if (!overwrite) { - if (uploadInBlocks(filePath)) { + if (uploadInBlocks(filePath, BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES)) { overwriteCheck = exists().flatMap(exists -> exists ? monoError(logger, new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)) : Mono.empty()); @@ -538,6 +538,8 @@ public Mono uploadFromFile(String filePath, boolean overwrite) { public Mono uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobRequestConditions requestConditions) { + final ParallelTransferOptions finalParallelTransferOptions = + ModelHelper.populateAndApplyDefaults(parallelTransferOptions); try { return Mono.using(() -> uploadFileResourceSupplier(filePath), channel -> { @@ -546,8 +548,8 @@ public Mono uploadFromFile(String filePath, ParallelTransferOptions parall long fileSize = channel.size(); // If the file is larger than 256MB chunk it and stage it as blocks. - if (uploadInBlocks(filePath)) { - return uploadBlocks(fileSize, parallelTransferOptions, headers, metadata, tier, + if (uploadInBlocks(filePath, finalParallelTransferOptions.getMaxSingleUploadSize())) { + return uploadBlocks(fileSize, finalParallelTransferOptions, headers, metadata, tier, requestConditions, channel, blockBlobAsyncClient); } else { // Otherwise we know it can be sent in a single request reducing network overhead. @@ -564,11 +566,11 @@ public Mono uploadFromFile(String filePath, ParallelTransferOptions parall } } - boolean uploadInBlocks(String filePath) { + boolean uploadInBlocks(String filePath, Integer maxSingleUploadSize) { AsynchronousFileChannel channel = uploadFileResourceSupplier(filePath); boolean retVal; try { - retVal = channel.size() > 256 * Constants.MB; + retVal = channel.size() > maxSingleUploadSize; } catch (IOException e) { throw logger.logExceptionAsError(new UncheckedIOException(e)); } finally { @@ -581,17 +583,16 @@ boolean uploadInBlocks(String filePath) { private Mono uploadBlocks(long fileSize, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobRequestConditions requestConditions, AsynchronousFileChannel channel, BlockBlobAsyncClient client) { - final ParallelTransferOptions finalParallelTransferOptions = - ModelHelper.populateAndApplyDefaults(parallelTransferOptions); final BlobRequestConditions finalRequestConditions = (requestConditions == null) ? new BlobRequestConditions() : requestConditions; + // parallelTransferOptions are finalized in the calling method. // See ProgressReporter for an explanation on why this lock is necessary and why we use AtomicLong. AtomicLong totalProgress = new AtomicLong(); Lock progressLock = new ReentrantLock(); final SortedMap blockIds = new TreeMap<>(); - return Flux.fromIterable(sliceFile(fileSize, finalParallelTransferOptions.getBlockSize(), + return Flux.fromIterable(sliceFile(fileSize, parallelTransferOptions.getBlockSize(), parallelTransferOptions)) .flatMap(chunk -> { String blockId = getBlockID(); @@ -599,7 +600,7 @@ private Mono uploadBlocks(long fileSize, ParallelTransferOptions parallelT Flux progressData = ProgressReporter.addParallelProgressReporting( FluxUtil.readFile(channel, chunk.getOffset(), chunk.getCount()), - finalParallelTransferOptions.getProgressReceiver(), progressLock, totalProgress); + parallelTransferOptions.getProgressReceiver(), progressLock, totalProgress); return client.stageBlockWithResponse(blockId, progressData, chunk.getCount(), null, finalRequestConditions.getLeaseId()); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java index 718d9d4cf95b..9180d76f63b4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java @@ -145,7 +145,7 @@ public void uploadFromFile(String filePath, boolean overwrite) { if (!overwrite) { // Note we only want to make the exists call if we will be uploading in stages. Otherwise it is superfluous. - if (client.uploadInBlocks(filePath) && exists()) { + if (client.uploadInBlocks(filePath, BlockBlobClient.MAX_UPLOAD_BLOB_BYTES) && exists()) { throw logger.logExceptionAsError(new IllegalArgumentException(Constants.BLOB_ALREADY_EXISTS)); } requestConditions = new BlobRequestConditions().setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD); @@ -157,7 +157,7 @@ public void uploadFromFile(String filePath, boolean overwrite) { * Creates a new block blob, or updates the content of an existing block blob. *

* To avoid overwriting, pass "*" to {@link BlobRequestConditions#setIfNoneMatch(String)}. - * + * *

Code Samples

* * {@codesnippet com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobRequestConditions-Duration} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java index f8a980a586f6..79737482d8f7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java @@ -5,6 +5,7 @@ import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.models.ParallelTransferOptions; +import com.azure.storage.blob.specialized.BlockBlobAsyncClient; import java.util.regex.Pattern; @@ -31,6 +32,8 @@ public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferO : other.getBlockSize(), other.getNumBuffers() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_NUMBER_OF_BUFFERS) : other.getNumBuffers(), - other.getProgressReceiver()); + other.getProgressReceiver(), + other.getMaxSingleUploadSize() == null ? Integer.valueOf(BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES) + : other.getMaxSingleUploadSize()); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ParallelTransferOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ParallelTransferOptions.java index 369976363a28..db293a76cb7a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ParallelTransferOptions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ParallelTransferOptions.java @@ -18,6 +18,7 @@ public final class ParallelTransferOptions { private final Integer blockSize; private final Integer numBuffers; private final ProgressReceiver progressReceiver; + private final Integer maxSingleUploadSize; /** * Creates a new {@link ParallelTransferOptions} with default parameters applied. @@ -35,6 +36,33 @@ public final class ParallelTransferOptions { * @param progressReceiver {@link ProgressReceiver} */ public ParallelTransferOptions(Integer blockSize, Integer numBuffers, ProgressReceiver progressReceiver) { + this(blockSize, numBuffers, progressReceiver, null); + } + + /** + * Creates a new {@link ParallelTransferOptions} with default parameters applied. + * + * @param blockSize The block size. + * For upload, The block size is the size of each block that will be staged. This value also determines the number + * of requests that need to be made. If block size is large, upload will make fewer network calls, but each + * individual call will send more data and will therefore take longer. This parameter also determines the size + * that each buffer uses when buffering is required and consequently amount of memory consumed by such methods may + * be up to blockSize * numBuffers. + * @param numBuffers For buffered upload only, the number of buffers is the maximum number of buffers this method + * should allocate. Memory will be allocated lazily as needed. Must be at least two. Typically, the larger the + * number of buffers, the more parallel, and thus faster, the upload portion of this operation will be. + * The amount of memory consumed by methods using this value may be up to blockSize * numBuffers. + * @param progressReceiver {@link ProgressReceiver} + * @param maxSingleUploadSize If the size of the data is less than or equal to this value, it will be uploaded in a + * single put rather than broken up into chunks. If the data is uploaded in a single shot, the block size will be + * ignored. Some constraints to consider are that more requests cost more, but several small or mid-sized requests + * may sometimes perform better. In the case of buffered upload, up to this amount of data may be buffered before + * any data is sent. Must be greater than 0. May be null to accept default behavior, which is the maximum value the + * service accepts for uploading in a single requests and is represented by + * {@link BlockBlobAsyncClient#MAX_UPLOAD_BLOB_BYTES}. + */ + public ParallelTransferOptions(Integer blockSize, Integer numBuffers, ProgressReceiver progressReceiver, + Integer maxSingleUploadSize) { if (blockSize != null) { StorageImplUtils.assertInBounds("blockSize", blockSize, 1, BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES); } @@ -45,6 +73,12 @@ public ParallelTransferOptions(Integer blockSize, Integer numBuffers, ProgressRe } this.numBuffers = numBuffers; this.progressReceiver = progressReceiver; + + if (maxSingleUploadSize != null) { + StorageImplUtils.assertInBounds("maxSingleUploadSize", maxSingleUploadSize, 1, + BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES); + } + this.maxSingleUploadSize = maxSingleUploadSize; } /** @@ -65,9 +99,17 @@ public Integer getNumBuffers() { /** * Gets the Progress receiver for parallel reporting - * @return the progress reporter + * @return The progress reporter */ public ProgressReceiver getProgressReceiver() { return this.progressReceiver; } + + /** + * Gets the value above which the upload will be broken into blocks and parallelized. + * @return The threshold value. + */ + public Integer getMaxSingleUploadSize() { + return this.maxSingleUploadSize; + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index 70dcdddd4621..2e2660d4c149 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -65,11 +65,14 @@ import java.nio.channels.AsynchronousFileChannel; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; +import java.nio.file.OpenOption; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -680,8 +683,42 @@ private Mono downloadHelper(BlobRange range, DownloadRetryOpti * @return A reactive response containing the blob properties and metadata. */ public Mono downloadToFile(String filePath) { + return downloadToFile(filePath, false); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

If overwrite is set to false, the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String-boolean} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param overwrite Whether or not to overwrite the file, should the file exist. + * @return A reactive response containing the blob properties and metadata. + */ + public Mono downloadToFile(String filePath, boolean overwrite) { try { - return downloadToFileWithResponse(filePath, null, null, null, null, false).flatMap(FluxUtil::toMono); + Set openOptions = null; + if (overwrite) { + openOptions = new HashSet<>(); + openOptions.add(StandardOpenOption.CREATE); + openOptions.add(StandardOpenOption.TRUNCATE_EXISTING); // If the file already exists and it is opened + // for WRITE access, then its length is truncated to 0. + openOptions.add(StandardOpenOption.READ); + openOptions.add(StandardOpenOption.WRITE); + } + return downloadToFileWithResponse(filePath, null, null, null, null, false, openOptions) + .flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -720,9 +757,48 @@ public Mono downloadToFile(String filePath) { public Mono> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean rangeGetContentMd5) { + return downloadToFileWithResponse(filePath, range, parallelTransferOptions, options, requestConditions, + rangeGetContentMd5, null); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

By default the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown. To override this behavior, provide appropriate + * {@link OpenOption OpenOptions}

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra + * call, provide the {@link BlobRange} parameter.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param range {@link BlobRange} + * @param parallelTransferOptions {@link ParallelTransferOptions} to use to download to file. Number of parallel + * transfers parameter is ignored. + * @param options {@link DownloadRetryOptions} + * @param requestConditions {@link BlobRequestConditions} + * @param rangeGetContentMd5 Whether the contentMD5 for the specified blob range should be returned. + * @param openOptions {@link OpenOption OpenOptions} to use to configure how to open or create the file. + * @return A reactive response containing the blob properties and metadata. + * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB. + * @throws UncheckedIOException If an I/O error occurs. + */ + public Mono> downloadToFileWithResponse(String filePath, BlobRange range, + ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, + BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions) { try { return withContext(context -> downloadToFileWithResponse(filePath, range, parallelTransferOptions, options, - requestConditions, rangeGetContentMd5, context)); + requestConditions, rangeGetContentMd5, openOptions, context)); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -730,24 +806,32 @@ public Mono> downloadToFileWithResponse(String filePath Mono> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, - BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Context context) { + BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions, + Context context) { BlobRange finalRange = range == null ? new BlobRange(0) : range; final ParallelTransferOptions finalParallelTransferOptions = ModelHelper.populateAndApplyDefaults(parallelTransferOptions); BlobRequestConditions finalConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - AsynchronousFileChannel channel = downloadToFileResourceSupplier(filePath); + // Default behavior is not to overwrite + if (openOptions == null) { + openOptions = new HashSet<>(); + openOptions.add(StandardOpenOption.CREATE_NEW); + openOptions.add(StandardOpenOption.WRITE); + openOptions.add(StandardOpenOption.READ); + } + + AsynchronousFileChannel channel = downloadToFileResourceSupplier(filePath, openOptions); return Mono.just(channel) .flatMap(c -> this.downloadToFileImpl(c, finalRange, finalParallelTransferOptions, downloadRetryOptions, finalConditions, rangeGetContentMd5, context)) .doFinally(signalType -> this.downloadToFileCleanup(channel, filePath, signalType)); } - private AsynchronousFileChannel downloadToFileResourceSupplier(String filePath) { + private AsynchronousFileChannel downloadToFileResourceSupplier(String filePath, Set openOptions) { try { - return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE, - StandardOpenOption.CREATE_NEW); + return AsynchronousFileChannel.open(Paths.get(filePath), openOptions, null); } catch (IOException e) { throw logger.logExceptionAsError(new UncheckedIOException(e)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java index bc0df9fcc0c1..3944bf78c38c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java @@ -40,9 +40,13 @@ import java.io.UncheckedIOException; import java.net.URL; import java.nio.file.FileAlreadyExistsException; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import static com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout; @@ -444,7 +448,42 @@ public BlobDownloadResponse downloadWithResponse(OutputStream stream, BlobRange * @throws UncheckedIOException If an I/O error occurs */ public BlobProperties downloadToFile(String filePath) { - return downloadToFileWithResponse(filePath, null, null, null, null, false, null, Context.NONE).getValue(); + return downloadToFile(filePath, false); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

If overwrite is set to false, the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String-boolean} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param overwrite Whether or not to overwrite the file, should the file exist. + * @return The blob properties and metadata. + * @throws UncheckedIOException If an I/O error occurs + */ + public BlobProperties downloadToFile(String filePath, boolean overwrite) { + Set openOptions = null; + if (overwrite) { + openOptions = new HashSet<>(); + openOptions.add(StandardOpenOption.CREATE); + openOptions.add(StandardOpenOption.TRUNCATE_EXISTING); // If the file already exists and it is opened + // for WRITE access, then its length is truncated to 0. + openOptions.add(StandardOpenOption.READ); + openOptions.add(StandardOpenOption.WRITE); + } + return downloadToFileWithResponse(filePath, null, null, null, null, false, openOptions, null, Context.NONE) + .getValue(); } /** @@ -481,8 +520,49 @@ public BlobProperties downloadToFile(String filePath) { public Response downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Duration timeout, Context context) { + return downloadToFileWithResponse(filePath, range, parallelTransferOptions, downloadRetryOptions, + requestConditions, rangeGetContentMd5, null, timeout, context); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

By default the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown. To override this behavior, provide appropriate + * {@link OpenOption OpenOptions}

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra + * call, provide the {@link BlobRange} parameter.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set-Duration-Context} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param range {@link BlobRange} + * @param parallelTransferOptions {@link ParallelTransferOptions} to use to download to file. Number of parallel + * transfers parameter is ignored. + * @param downloadRetryOptions {@link DownloadRetryOptions} + * @param requestConditions {@link BlobRequestConditions} + * @param rangeGetContentMd5 Whether the contentMD5 for the specified blob range should be returned. + * @param openOptions {@link OpenOption OpenOptions} to use to configure how to open or create the file. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the blob properties and metadata. + * @throws UncheckedIOException If an I/O error occurs. + */ + public Response downloadToFileWithResponse(String filePath, BlobRange range, + ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, + BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions, + Duration timeout, Context context) { Mono> download = client.downloadToFileWithResponse(filePath, range, - parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, context); + parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, openOptions, context); return blockWithOptionalTimeout(download, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java index c5caea22918a..2ed7d6ca5d18 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java @@ -3,24 +3,28 @@ package com.azure.storage.blob.specialized; import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClientBuilder; +import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.AppendBlobRequestConditions; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRequestConditions; import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.blob.models.CpkInfo; +import com.azure.storage.blob.models.CustomerProvidedKey; import com.azure.storage.blob.models.PageBlobRequestConditions; import com.azure.storage.blob.models.PageRange; +import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.common.StorageOutputStream; import com.azure.storage.common.implementation.Constants; import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxSink; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.io.IOException; import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; -import java.util.UUID; +import java.util.Map; /** * BlobOutputStream allows for the uploading of data to a blob using a stream-like approach. @@ -37,8 +41,9 @@ static BlobOutputStream appendBlobOutputStream(final AppendBlobAsyncClient clien } static BlobOutputStream blockBlobOutputStream(final BlockBlobAsyncClient client, - final BlobRequestConditions requestConditions) { - return new BlockBlobOutputStream(client, requestConditions); + final ParallelTransferOptions parallelTransferOptions, final BlobHttpHeaders headers, + final Map metadata, final AccessTier tier, final BlobRequestConditions requestConditions) { + return new BlockBlobOutputStream(client, parallelTransferOptions, headers, metadata, tier, requestConditions); } static BlobOutputStream pageBlobOutputStream(final PageBlobAsyncClient client, final PageRange pageRange, @@ -70,6 +75,11 @@ public synchronized void close() throws IOException { } catch (final BlobStorageException e) { throw new IOException(e); } + /* Need this check because for block blob the buffered upload error only manifests itself after commit is + called */ + if (this.lastError != null) { + throw lastError; + } } finally { // if close() is called again, an exception will be thrown this.lastError = new IOException(Constants.STREAM_CLOSED); @@ -134,62 +144,74 @@ void commit() { } private static final class BlockBlobOutputStream extends BlobOutputStream { - private final BlobRequestConditions requestConditions; - private final String blockIdPrefix; - private final List blockList; - private final BlockBlobAsyncClient client; + + private FluxSink sink; + + boolean complete; private BlockBlobOutputStream(final BlockBlobAsyncClient client, - final BlobRequestConditions requestConditions) { + final ParallelTransferOptions parallelTransferOptions, final BlobHttpHeaders headers, + final Map metadata, final AccessTier tier, final BlobRequestConditions requestConditions) { super(BlockBlobClient.MAX_STAGE_BLOCK_BYTES); - this.client = client; - this.requestConditions = (requestConditions == null) ? new BlobRequestConditions() : requestConditions; - this.blockIdPrefix = UUID.randomUUID().toString() + '-'; - this.blockList = new ArrayList<>(); - } - /** - * Generates a new block ID to be used for PutBlock. - * - * @return Base64 encoded block ID - */ - private String getCurrentBlockId() { - String blockIdSuffix = String.format("%06d", this.blockList.size()); - return Base64.getEncoder().encodeToString((this.blockIdPrefix + blockIdSuffix) - .getBytes(StandardCharsets.UTF_8)); - } + BlobAsyncClient blobClient = prepareBuilder(client).buildAsyncClient(); - private Mono writeBlock(Flux blockData, String blockId, long writeLength) { - return client.stageBlockWithResponse(blockId, blockData, writeLength, null, - this.requestConditions.getLeaseId()) - .then() + Flux fbb = Flux.create((FluxSink sink) -> this.sink = sink); + + /* Subscribe by upload takes too long. We need to subscribe so that the sink is actually created. Since + this subscriber doesn't do anything and no data has started flowing, there are no drawbacks to this extra + subscribe. */ + fbb.subscribe(); + + blobClient.uploadWithResponse(fbb, parallelTransferOptions, headers, metadata, tier, requestConditions) + // This allows the operation to continue while maintaining the error that occurred. .onErrorResume(BlobStorageException.class, e -> { this.lastError = new IOException(e); return Mono.empty(); - }); + }) + .doOnTerminate(() -> complete = true) + .subscribe(); } - @Override - protected Mono dispatchWrite(byte[] data, int writeLength, long offset) { - if (writeLength == 0) { - return Mono.empty(); + private BlobClientBuilder prepareBuilder(BlobAsyncClientBase client) { + BlobClientBuilder builder = new BlobClientBuilder() + .pipeline(client.getHttpPipeline()) + .endpoint(client.getBlobUrl()) + .snapshot(client.getSnapshotId()) + .serviceVersion(client.getServiceVersion()); + + CpkInfo cpk = client.getCustomerProvidedKey(); + if (cpk != null) { + builder.customerProvidedKey(new CustomerProvidedKey(cpk.getEncryptionKey())); } - final String blockID = this.getCurrentBlockId(); - this.blockList.add(blockID); + return builder; + } - Flux fbb = Flux.range(0, 1) - .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); + @Override + void commit() { + sink.complete(); + + // Need to wait until the uploadTask completes + while (!complete) { + try { + Thread.sleep(100L); + } catch (InterruptedException e) { + // Does this need to be caught by logger? + e.printStackTrace(); + } + } + } - return this.writeBlock(fbb.subscribeOn(Schedulers.elastic()), blockID, writeLength); + @Override + protected void writeInternal(final byte[] data, int offset, int length) { + sink.next(ByteBuffer.wrap(data, offset, length)); } - /** - * Commits the blob, for block blob this uploads the block list. - */ + // Never called @Override - synchronized void commit() { - client.commitBlockListWithResponse(this.blockList, null, null, null, this.requestConditions).block(); + protected Mono dispatchWrite(byte[] data, int writeLength, long offset) { + return Mono.empty(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java index 7d8a48e6b865..08be8ec2e766 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java @@ -18,6 +18,7 @@ import com.azure.storage.blob.models.BlockBlobItem; import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; +import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.Constants; import reactor.core.publisher.Flux; @@ -115,7 +116,29 @@ public BlobOutputStream getBlobOutputStream(boolean overwrite) { * @throws BlobStorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(BlobRequestConditions requestConditions) { - return BlobOutputStream.blockBlobOutputStream(client, requestConditions); + return getBlobOutputStream(null, null, null, null, requestConditions); + } + + /** + * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it + * will be overwritten. + *

+ * To avoid overwriting, pass "*" to {@link BlobRequestConditions#setIfNoneMatch(String)}. + * + * @param parallelTransferOptions {@link ParallelTransferOptions} used to configure buffered uploading. + * @param headers {@link BlobHttpHeaders} + * @param metadata Metadata to associate with the blob. + * @param tier {@link AccessTier} for the destination blob. + * @param requestConditions {@link BlobRequestConditions} + * + * @return A {@link BlobOutputStream} object used to write data to the blob. + * @throws BlobStorageException If a storage service error occurred. + */ + public BlobOutputStream getBlobOutputStream(ParallelTransferOptions parallelTransferOptions, + BlobHttpHeaders headers, Map metadata, AccessTier tier, + BlobRequestConditions requestConditions) { + return BlobOutputStream.blockBlobOutputStream(client, parallelTransferOptions, headers, metadata, tier, + requestConditions); } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java index 9058b8e3cb8a..305d39dcd087 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java @@ -24,10 +24,15 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UncheckedIOException; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.Map; +import java.util.Set; /** * Code snippets for {@link BlobAsyncClientBase} @@ -130,14 +135,28 @@ public void downloadToFileCodeSnippet() { client.downloadToFile(file).subscribe(response -> System.out.println("Completed download to file")); // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String-boolean + boolean overwrite = false; // Default value + client.downloadToFile(file, overwrite).subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String-boolean + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean BlobRange range = new BlobRange(1024, 2048L); DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5); client.downloadToFileWithResponse(file, range, null, options, null, false) .subscribe(response -> System.out.println("Completed download to file")); // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean + + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set + BlobRange blobRange = new BlobRange(1024, 2048L); + DownloadRetryOptions downloadRetryOptions = new DownloadRetryOptions().setMaxRetryRequests(5); + Set openOptions = new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW, + StandardOpenOption.WRITE, StandardOpenOption.READ)); // Default options + + client.downloadToFileWithResponse(file, blobRange, null, downloadRetryOptions, null, false, openOptions) + .subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java index 2cd4e3c850d8..c1000abd32d4 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java @@ -28,10 +28,15 @@ import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.io.UncheckedIOException; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.Map; +import java.util.Set; /** * Code snippets for {@link BlobClientBase} @@ -110,6 +115,12 @@ public void downloadToFile() { System.out.println("Completed download to file"); // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String-boolean + boolean overwrite = false; // Default value + client.downloadToFile(file, overwrite); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String-boolean + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Duration-Context BlobRange range = new BlobRange(1024, 2048L); DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5); @@ -118,6 +129,17 @@ public void downloadToFile() { options, null, false, timeout, new Context(key2, value2)); System.out.println("Completed download to file"); // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Duration-Context + + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set-Duration-Context + BlobRange blobRange = new BlobRange(1024, 2048L); + DownloadRetryOptions downloadRetryOptions = new DownloadRetryOptions().setMaxRetryRequests(5); + Set openOptions = new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW, + StandardOpenOption.WRITE, StandardOpenOption.READ)); // Default options + + client.downloadToFileWithResponse(file, blobRange, new ParallelTransferOptions(4 * Constants.MB, null, null), + downloadRetryOptions, null, false, openOptions, timeout, new Context(key2, value2)); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set-Duration-Context } /** diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index e989f13dc8c4..993df1c42454 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -148,7 +148,6 @@ class APISpec extends Specification { // in case the upload or download open too many connections. System.setProperty("reactor.bufferSize.x", "16") System.setProperty("reactor.bufferSize.small", "100") - System.out.println(String.format("--------%s---------", testMode)) } def setup() { @@ -160,6 +159,9 @@ class APISpec extends Specification { this.interceptorManager = new InterceptorManager(className + fullTestName, testMode) this.resourceNamer = new TestResourceNamer(className + testName, testMode, interceptorManager.getRecordedData()) + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + // If the test doesn't have the Requires tag record it in live mode. recordLiveMode = specificationContext.getCurrentIteration().getDescription().getAnnotation(Requires.class) != null diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy index 5628bb0fef5f..7a59ec06d6cf 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy @@ -36,9 +36,12 @@ import spock.lang.Requires import spock.lang.Unroll import java.nio.ByteBuffer +import java.nio.channels.NonWritableChannelException import java.nio.charset.StandardCharsets import java.nio.file.FileAlreadyExistsException import java.nio.file.Files +import java.nio.file.OpenOption +import java.nio.file.StandardOpenOption import java.security.MessageDigest import java.time.Duration import java.time.OffsetDateTime @@ -263,6 +266,7 @@ class BlobAPITest extends APISpec { } when: + // Default overwrite is false so this should fail bc.downloadToFile(testFile.getPath()) then: @@ -273,6 +277,23 @@ class BlobAPITest extends APISpec { testFile.delete() } + def "Download to file exists succeeds"() { + setup: + def testFile = new File(testName + ".txt") + if (!testFile.exists()) { + assert testFile.createNewFile() + } + + when: + bc.downloadToFile(testFile.getPath(), true) + + then: + new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8) == defaultText + + cleanup: + testFile.delete() + } + def "Download to file does not exist"() { setup: def testFile = new File(testName + ".txt") @@ -290,6 +311,49 @@ class BlobAPITest extends APISpec { testFile.delete() } + def "Download file does not exist open options"() { + setup: + def testFile = new File(testName + ".txt") + if (testFile.exists()) { + assert testFile.delete() + } + + when: + Set openOptions = new HashSet<>() + openOptions.add(StandardOpenOption.CREATE_NEW) + openOptions.add(StandardOpenOption.READ) + openOptions.add(StandardOpenOption.WRITE) + bc.downloadToFileWithResponse(testFile.getPath(), null, null, null, null, false, openOptions, null, null) + + then: + new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8) == defaultText + + cleanup: + testFile.delete() + } + + def "Download file exist open options"() { + setup: + def testFile = new File(testName + ".txt") + if (!testFile.exists()) { + assert testFile.createNewFile() + } + + when: + Set openOptions = new HashSet<>() + openOptions.add(StandardOpenOption.CREATE) + openOptions.add(StandardOpenOption.TRUNCATE_EXISTING) + openOptions.add(StandardOpenOption.READ) + openOptions.add(StandardOpenOption.WRITE) + bc.downloadToFileWithResponse(testFile.getPath(), null, null, null, null, false, openOptions, null, null) + + then: + new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8) == defaultText + + cleanup: + testFile.delete() + } + @Requires({ liveMode() }) @Unroll def "Download file"() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy index d42f857fee31..667013540f7d 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy @@ -39,7 +39,6 @@ class BlobOutputStreamTest extends APISpec { and: blockBlobClient.getBlobOutputStream() - then: thrown(IllegalArgumentException) } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy index e999bc602cee..871a32e2cdb3 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy @@ -103,5 +103,5 @@ class ProgressReporterTest extends APISpec { 0 * mockReceiver.reportProgress({ it > 60 }) } - // See TransferManagerTest for network tests of the parallel ProgressReporter. + // TODO (rickle-msft): See TransferManagerTest for network tests of the parallel ProgressReporter. } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy index 587654085599..5f98a26dcb9d 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy @@ -760,6 +760,60 @@ class BlockBlobAPITest extends APISpec { file.delete() } + @Unroll + @Requires({ liveMode() }) + def "Upload from file reporter"() { + when: + def uploadReporter = new Reporter(blockSize) + def file = getRandomFile(size) + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions(blockSize, bufferCount, + uploadReporter) + + then: + StepVerifier.create(blobAsyncClient.uploadFromFile(file.toPath().toString(), parallelTransferOptions, + null, null, null, null)) + .assertNext({ + assert uploadReporter.getReportingCount() == (long) (size / blockSize) + }).verifyComplete() + + cleanup: + file.delete() + + where: + size | blockSize | bufferCount + 10 * Constants.MB | 10 * Constants.MB | 8 + 20 * Constants.MB | 1 * Constants.MB | 5 + 10 * Constants.MB | 5 * Constants.MB | 2 + 10 * Constants.MB | 10 * Constants.KB | 100 + } + + @Unroll + @Requires({ liveMode() }) + def "Upload from file options"() { + setup: + def file = getRandomFile(dataSize) + + when: + blobClient.uploadFromFile(file.toPath().toString(), + new ParallelTransferOptions(blockSize, null, null, singleUploadSize), null, null, null, null, null) + + then: + blobClient.getBlockBlobClient() + .listBlocks(BlockListType.COMMITTED).getCommittedBlocks().size() == expectedBlockCount + + + cleanup: + file.delete() + + where: + dataSize | singleUploadSize | blockSize || expectedBlockCount + BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES - 1 | null | null || 0 // Test that the default for singleUploadSize is the maximum + BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES + 1 | null | null || Math.ceil(((double) BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES + 1) / (double) BlobClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) // "". This also validates the default for blockSize + 100 | 50 | null || 1 // Test that singleUploadSize is respected + 100 | 50 | 20 || 5 // Test that blockSize is respected + } + def "Upload min"() { when: blockBlobClient.upload(defaultInputStream.get(), defaultDataSize, true) @@ -1218,9 +1272,9 @@ class BlockBlobAPITest extends APISpec { then: StepVerifier.create(uploadOperation.then(blockBlobAsyncClient.getPropertiesWithResponse(null))) .assertNext({ - assert validateBlobProperties(it, cacheControl, contentDisposition, contentEncoding, contentLanguage, - contentMD5, contentType == null ? "application/octet-stream" : contentType) - }).verifyComplete() + assert validateBlobProperties(it, cacheControl, contentDisposition, contentEncoding, contentLanguage, + contentMD5, contentType == null ? "application/octet-stream" : contentType) + }).verifyComplete() // HTTP default content type is application/octet-stream. where: @@ -1254,9 +1308,9 @@ class BlockBlobAPITest extends APISpec { then: StepVerifier.create(uploadOperation.then(blobAsyncClient.getPropertiesWithResponse(null))) .assertNext({ - assert it.getStatusCode() == 200 - assert it.getValue().getMetadata() == metadata - }).verifyComplete() + assert it.getStatusCode() == 200 + assert it.getValue().getMetadata() == metadata + }).verifyComplete() where: key1 | value1 | key2 | value2 @@ -1264,6 +1318,28 @@ class BlockBlobAPITest extends APISpec { "foo" | "bar" | "fizz" | "buzz" } + @Unroll + @Requires({ liveMode() }) + def "Buffered upload options"() { + setup: + def data = getRandomData(dataSize) + + when: + blobAsyncClient.uploadWithResponse(Flux.just(data), + new ParallelTransferOptions(blockSize, null, null, singleUploadSize), null, null, null, null).block() + + then: + blobAsyncClient.getBlockBlobAsyncClient() + .listBlocks(BlockListType.COMMITTED).block().getCommittedBlocks().size() == expectedBlockCount + + where: + dataSize | singleUploadSize | blockSize || expectedBlockCount + BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES - 1 | null | null || 0 // Test that the default for singleUploadSize is the maximum + BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES + 1 | null | null || Math.ceil(((double) BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES + 1) / (double) BlobClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) // "". This also validates the default for blockSize + 100 | 50 | null || 1 // Test that singleUploadSize is respected + 100 | 50 | 20 || 5 // Test that blockSize is respected + } + // Only run these tests in live mode as they use variables that can't be captured. @Unroll @Requires({ liveMode() }) @@ -1427,9 +1503,9 @@ class BlockBlobAPITest extends APISpec { // A second subscription to a download stream will StepVerifier.create(blobAsyncClient.upload(blockBlobAsyncClient.download(), parallelTransferOptions, true)) .verifyErrorSatisfies({ - assert it instanceof BlobStorageException - assert it.getStatusCode() == 500 - }) + assert it instanceof BlobStorageException + assert it.getStatusCode() == 500 + }) } @Requires({ liveMode() }) diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json new file mode 100644 index 000000000000..b9a809806b7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "250e22c7-c995-4ddf-a3ba-efc27723e0f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D785A6954049C0", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c72e9cc0-001e-0016-5c8f-b764ec000000", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-client-request-id" : "250e22c7-c995-4ddf-a3ba-efc27723e0f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79/javablobdownloadfiledoesnotexistopenoptions11894382a29b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4e421bd1-c9a7-4359-a195-9c1d556fe5f5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D785A6955FA3AD", + "Content-Length" : "0", + "x-ms-request-id" : "c72e9cd5-001e-0016-6f8f-b764ec000000", + "x-ms-client-request-id" : "4e421bd1-c9a7-4359-a195-9c1d556fe5f5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79/javablobdownloadfiledoesnotexistopenoptions11894382a29b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d8a96f02-a74d-4be4-842e-0541803e9471" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:41 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D785A6955FA3AD", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c72e9cde-001e-0016-788f-b764ec000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d8a96f02-a74d-4be4-842e-0541803e9471", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadfiledoesnotexistopenoptions&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "52ddb186-fb70-4870-9c86-2df33ed1990b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c72e9cf4-001e-0016-0e8f-b764ec000000", + "Body" : "jtcdownloadfiledoesnotexistopenoptionsjtcdownloadfiledoesnotexistopenoptions02899367a6b4e79Fri, 20 Dec 2019 23:44:41 GMT\"0x8D785A6954049C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-client-request-id" : "52ddb186-fb70-4870-9c86-2df33ed1990b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9adcbc59-e868-492e-b48b-91122018b2db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c72e9d09-001e-0016-228f-b764ec000000", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-client-request-id" : "9adcbc59-e868-492e-b48b-91122018b2db" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79", "javablobdownloadfiledoesnotexistopenoptions11894382a29b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json new file mode 100644 index 000000000000..85d7435f6a09 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7bbc621e-d546-4595-8e6e-d2f2d251bd3d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D785A698DA9CBA", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d4138152-b01e-003c-1f8f-b7bbfc000000", + "Date" : "Fri, 20 Dec 2019 23:44:46 GMT", + "x-ms-client-request-id" : "7bbc621e-d546-4595-8e6e-d2f2d251bd3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4/javablobdownloadfileexistopenoptions165910938502956c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c81853c1-60ed-4d0f-92dc-82da3705a1ef", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 20 Dec 2019 23:44:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D785A698FAF169", + "Content-Length" : "0", + "x-ms-request-id" : "d413816e-b01e-003c-388f-b7bbfc000000", + "x-ms-client-request-id" : "c81853c1-60ed-4d0f-92dc-82da3705a1ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4/javablobdownloadfileexistopenoptions165910938502956c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d44d712c-f3c7-4080-8757-e4c4519261df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:47 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 20 Dec 2019 23:44:46 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D785A698FAF169", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d413817a-b01e-003c-448f-b7bbfc000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d44d712c-f3c7-4080-8757-e4c4519261df", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadfileexistopenoptions&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2174cd50-6809-460c-918e-baa431f8d1f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d4138188-b01e-003c-518f-b7bbfc000000", + "Body" : "jtcdownloadfileexistopenoptionsjtcdownloadfileexistopenoptions04880095a4282c15bc4Fri, 20 Dec 2019 23:44:47 GMT\"0x8D785A698DA9CBA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:47 GMT", + "x-ms-client-request-id" : "2174cd50-6809-460c-918e-baa431f8d1f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c7b8cec4-d64b-41bd-9886-39d9e41f9c95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d4138193-b01e-003c-5c8f-b7bbfc000000", + "Date" : "Fri, 20 Dec 2019 23:44:47 GMT", + "x-ms-client-request-id" : "c7b8cec4-d64b-41bd-9886-39d9e41f9c95" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadfileexistopenoptions04880095a4282c15bc4", "javablobdownloadfileexistopenoptions165910938502956c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json index d77e531edd6e..106bd912697f 100644 --- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json @@ -1,88 +1,57 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "d5278936-f352-4300-9879-c3f6e7831de7" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2c602f4e-2286-4c53-a71b-5c1bb4e85418" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75A7E30E8ADFB", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "ETag" : "0x8D785A68D2E8A64", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:27 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "161e6599-301e-013a-3a67-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "d5278936-f352-4300-9879-c3f6e7831de7" + "x-ms-request-id" : "135ab365-501e-001b-3e8f-b7ac38000000", + "Date" : "Fri, 20 Dec 2019 23:44:26 GMT", + "x-ms-client-request-id" : "2c602f4e-2286-4c53-a71b-5c1bb4e85418" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141/javablobdownloadtofiledoesnotexist191575f30f3eaddd5", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344/javablobdownloadtofiledoesnotexist1944333aaba2cac77", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "e82ecd76-97a6-4dd5-a4c8-3fb987d693ca", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f211c0b3-732f-49ee-bb03-2bec04acf497", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:27 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Date" : "Fri, 20 Dec 2019 23:44:26 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75A7E30F07167", + "ETag" : "0x8D785A68D4EF9AC", "Content-Length" : "0", - "x-ms-request-id" : "161e65a1-301e-013a-4167-8c3580000000", - "x-ms-client-request-id" : "e82ecd76-97a6-4dd5-a4c8-3fb987d693ca" - }, - "Exception" : null - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141/javablobdownloadtofiledoesnotexist191575f30f3eaddd5", - "Headers" : { - "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "c27b5db0-fc65-4c2a-9c6e-556c5dc21573" - }, - "Response" : { - "x-ms-version" : "2019-02-02", - "x-ms-lease-status" : "unlocked", - "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-lease-state" : "available", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-blob-type" : "BlockBlob", - "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "Accept-Ranges" : "bytes", - "x-ms-server-encrypted" : "true", - "x-ms-access-tier-inferred" : "true", - "x-ms-access-tier" : "Hot", - "ETag" : "0x8D75A7E30F07167", - "x-ms-creation-time" : "Sun, 27 Oct 2019 01:37:12 GMT", - "Content-Length" : "7", - "x-ms-request-id" : "161e65b4-301e-013a-4c67-8c3580000000", - "x-ms-client-request-id" : "c27b5db0-fc65-4c2a-9c6e-556c5dc21573", - "Content-Type" : "application/octet-stream" + "x-ms-request-id" : "135ab371-501e-001b-478f-b7ac38000000", + "x-ms-client-request-id" : "f211c0b3-732f-49ee-bb03-2bec04acf497" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141/javablobdownloadtofiledoesnotexist191575f30f3eaddd5", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344/javablobdownloadtofiledoesnotexist1944333aaba2cac77", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "17b03287-090c-498f-9917-6d683fca860b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "81e0f400-6d7e-4628-a241-8c2e0fb89e24" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -91,29 +60,29 @@ "Content-Range" : "bytes 0-6/7", "x-ms-lease-state" : "available", "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:27 GMT", "retry-after" : "0", "StatusCode" : "206", - "Date" : "Sun, 27 Oct 2019 01:37:13 GMT", + "Date" : "Fri, 20 Dec 2019 23:44:26 GMT", "x-ms-blob-type" : "BlockBlob", "Accept-Ranges" : "bytes", "x-ms-server-encrypted" : "true", - "ETag" : "0x8D75A7E30F07167", - "x-ms-creation-time" : "Sun, 27 Oct 2019 01:37:12 GMT", + "ETag" : "0x8D785A68D4EF9AC", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:27 GMT", "Content-Length" : "7", - "x-ms-request-id" : "161e65c0-301e-013a-5767-8c3580000000", + "x-ms-request-id" : "135ab378-501e-001b-4e8f-b7ac38000000", "Body" : "[100, 101, 102, 97, 117, 108, 116]", - "x-ms-client-request-id" : "17b03287-090c-498f-9917-6d683fca860b", + "x-ms-client-request-id" : "81e0f400-6d7e-4628-a241-8c2e0fb89e24", "Content-Type" : "application/octet-stream" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadtofiledoesnotexist&comp=list", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadtofiledoesnotexist&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "6a0bdeb4-e335-44ce-b68f-a1945400381a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "866138f8-a63b-4566-8128-b10096fa9674" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -121,20 +90,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "161e65d8-301e-013a-6967-8c3580000000", - "Body" : "jtcdownloadtofiledoesnotexistjtcdownloadtofiledoesnotexist0128346b089568604141Sun, 27 Oct 2019 01:37:12 GMT\"0x8D75A7E30E8ADFB\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Sun, 27 Oct 2019 01:37:13 GMT", - "x-ms-client-request-id" : "6a0bdeb4-e335-44ce-b68f-a1945400381a", + "x-ms-request-id" : "135ab37b-501e-001b-518f-b7ac38000000", + "Body" : "jtcdownloadtofiledoesnotexistjtcdownloadtofiledoesnotexist0024275cbd3672129344Fri, 20 Dec 2019 23:44:27 GMT\"0x8D785A68D2E8A64\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:27 GMT", + "x-ms-client-request-id" : "866138f8-a63b-4566-8128-b10096fa9674", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "665eb1d1-1bb8-4c21-90a6-1948707af336" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c3e54cd1-64ec-47dd-b028-872c88a8a515" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -142,11 +111,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "161e65e3-301e-013a-7267-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:13 GMT", - "x-ms-client-request-id" : "665eb1d1-1bb8-4c21-90a6-1948707af336" + "x-ms-request-id" : "135ab382-501e-001b-588f-b7ac38000000", + "Date" : "Fri, 20 Dec 2019 23:44:27 GMT", + "x-ms-client-request-id" : "c3e54cd1-64ec-47dd-b028-872c88a8a515" }, "Exception" : null } ], - "variables" : [ "jtcdownloadtofiledoesnotexist0128346b089568604141", "javablobdownloadtofiledoesnotexist191575f30f3eaddd5" ] + "variables" : [ "jtcdownloadtofiledoesnotexist0024275cbd3672129344", "javablobdownloadtofiledoesnotexist1944333aaba2cac77" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json index e7c5e5baca0b..4f658045b66a 100644 --- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json @@ -1,57 +1,57 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists0298267b4b3ff5b0d344fb9?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexists096284cd349d96e6894615b?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "9e84f432-dfb5-401b-a789-95227683f273" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "877308ef-878c-4e5f-8297-c340f9b6f12b" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75A7E30C650A7", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "ETag" : "0x8D785A6859A6889", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:14 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "161e6566-301e-013a-0f67-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "9e84f432-dfb5-401b-a789-95227683f273" + "x-ms-request-id" : "3f3f5c68-501e-0024-5c8f-b7649b000000", + "Date" : "Fri, 20 Dec 2019 23:44:14 GMT", + "x-ms-client-request-id" : "877308ef-878c-4e5f-8297-c340f9b6f12b" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists0298267b4b3ff5b0d344fb9/javablobdownloadtofileexists199775a51f46ceaa9c41", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexists096284cd349d96e6894615b/javablobdownloadtofileexists160998f87cd14a25c740", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "a63a0a6a-a5dc-4a9a-92c3-7d642d473a41", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c6c2734a-34a2-4681-a3c2-95bceb1d7f12", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:15 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Date" : "Fri, 20 Dec 2019 23:44:14 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75A7E30D05E86", + "ETag" : "0x8D785A685B95044", "Content-Length" : "0", - "x-ms-request-id" : "161e657c-301e-013a-2067-8c3580000000", - "x-ms-client-request-id" : "a63a0a6a-a5dc-4a9a-92c3-7d642d473a41" + "x-ms-request-id" : "3f3f5c7e-501e-0024-708f-b7649b000000", + "x-ms-client-request-id" : "c6c2734a-34a2-4681-a3c2-95bceb1d7f12" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadtofileexists&comp=list", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadtofileexists&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "ceb77eea-d2a7-4a31-a953-028e10262c3b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4da31a8e-7637-4c10-841e-03a576d0df6f" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -59,20 +59,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "161e6585-301e-013a-2867-8c3580000000", - "Body" : "jtcdownloadtofileexistsjtcdownloadtofileexists0298267b4b3ff5b0d344fb9Sun, 27 Oct 2019 01:37:12 GMT\"0x8D75A7E30C650A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "ceb77eea-d2a7-4a31-a953-028e10262c3b", + "x-ms-request-id" : "3f3f5c82-501e-0024-748f-b7649b000000", + "Body" : "jtcdownloadtofileexistsjtcdownloadtofileexists096284cd349d96e6894615bFri, 20 Dec 2019 23:44:14 GMT\"0x8D785A6859A6889\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:15 GMT", + "x-ms-client-request-id" : "4da31a8e-7637-4c10-841e-03a576d0df6f", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists0298267b4b3ff5b0d344fb9?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexists096284cd349d96e6894615b?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "c7a43be8-e4e2-49bd-b327-a6901be20a9e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1060987e-9486-4e1b-b720-c0745ab8e47c" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -80,11 +80,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "161e6590-301e-013a-3367-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "c7a43be8-e4e2-49bd-b327-a6901be20a9e" + "x-ms-request-id" : "3f3f5c87-501e-0024-788f-b7649b000000", + "Date" : "Fri, 20 Dec 2019 23:44:15 GMT", + "x-ms-client-request-id" : "1060987e-9486-4e1b-b720-c0745ab8e47c" }, "Exception" : null } ], - "variables" : [ "jtcdownloadtofileexists0298267b4b3ff5b0d344fb9", "javablobdownloadtofileexists199775a51f46ceaa9c41" ] + "variables" : [ "jtcdownloadtofileexists096284cd349d96e6894615b", "javablobdownloadtofileexists160998f87cd14a25c740" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json new file mode 100644 index 000000000000..fc1e373ebb7c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dfdd82b9-c5a7-4197-8c2b-a47e0d12b206" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D785A689017FC1", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "bfd6dcfc-001e-0029-728f-b7ac4f000000", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "x-ms-client-request-id" : "dfdd82b9-c5a7-4197-8c2b-a47e0d12b206" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4/javablobdownloadtofileexistssucceeds107956e96a6f95a8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "12ba715d-8099-46db-b600-bfad65edd707", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D785A689237A1F", + "Content-Length" : "0", + "x-ms-request-id" : "bfd6dd03-001e-0029-778f-b7ac4f000000", + "x-ms-client-request-id" : "12ba715d-8099-46db-b600-bfad65edd707" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4/javablobdownloadtofileexistssucceeds107956e96a6f95a8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e5410772-924f-4cbe-9e60-0a3038ac0219" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:20 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D785A689237A1F", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "bfd6dd0a-001e-0029-7e8f-b7ac4f000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "e5410772-924f-4cbe-9e60-0a3038ac0219", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadtofileexistssucceeds&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "833f516e-de8c-4c85-b5d7-4a2cf61224af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "bfd6dd13-001e-0029-078f-b7ac4f000000", + "Body" : "jtcdownloadtofileexistssucceedsjtcdownloadtofileexistssucceeds087572dd477056d04a4Fri, 20 Dec 2019 23:44:20 GMT\"0x8D785A689017FC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "x-ms-client-request-id" : "833f516e-de8c-4c85-b5d7-4a2cf61224af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "574fcc77-94cc-479d-8cb5-bc7a7b56731b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "bfd6dd16-001e-0029-0a8f-b7ac4f000000", + "Date" : "Fri, 20 Dec 2019 23:44:21 GMT", + "x-ms-client-request-id" : "574fcc77-94cc-479d-8cb5-bc7a7b56731b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadtofileexistssucceeds087572dd477056d04a4", "javablobdownloadtofileexistssucceeds107956e96a6f95a8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-common/CHANGELOG.md b/sdk/storage/azure-storage-common/CHANGELOG.md index 8a167f5c9673..92aa2bd426f3 100644 --- a/sdk/storage/azure-storage-common/CHANGELOG.md +++ b/sdk/storage/azure-storage-common/CHANGELOG.md @@ -1,12 +1,14 @@ # Release History -## Version XX.X.X (XXXX-XX-XX) +## 12.2.0-beta.2 (Unreleased) + +## 12.2.0-beta.1 (2019-12-18) - Added generateSas methods on service clients to improve discoverability and convenience of sas. Deprecated setters of required parameters, generateSasQueryParameters methods on AccountSasSignatureValues to direct users to using the methods added on clients. -## Version 12.1.0 (2019-12-04) +## 12.1.0 (2019-12-04) - Upgraded to version 1.1.0 of Azure Core. -## Version 12.0.0 (2019-10-31) +## 12.0.0 (2019-10-31) - Removed BaseClientBuilder - Renamed RequestRetryOptions maxTries, tryTimeout, secondaryHost, retryDelayInMs, maxRetryDelayInMs to getMaxTries, getTryTimeout, getSecondaryHosy, getRetryDelayInMs, getMaxRetryDelayInMs - Renamed IpRange to SasIpRange diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index 5168b7f1b931..fd21c5b3c90d 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-common - 12.2.0-beta.1 + 12.2.0-beta.2 Microsoft Azure common module for Storage This module contains common code based for all Microsoft Azure Storage client libraries. @@ -36,7 +36,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 org.slf4j @@ -62,7 +62,7 @@ com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java index cdeb0a129e81..78a7c6e0bf8b 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java @@ -42,7 +42,7 @@ protected StorageOutputStream(final int writeThreshold) { * @param offset An int which represents the start offset in the data. * @param length An int which represents the number of bytes to write. */ - private void writeInternal(final byte[] data, int offset, int length) { + protected void writeInternal(final byte[] data, int offset, int length) { int chunks = (int) (Math.ceil((double) length / (double) this.writeThreshold)); Flux.range(0, chunks).map(c -> offset + c * this.writeThreshold) .concatMap(pos -> processChunk(data, pos, offset, length)) @@ -125,7 +125,7 @@ public void write(@NonNull final byte[] data, final int offset, final int length *

* true is acceptable for you. * - * @param byteVal An int which represents the bye value to write. + * @param byteVal An int which represents the byte value to write. */ @Override public void write(final int byteVal) { diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 7ba66710578c..1d276bcfb60c 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,12 +1,14 @@ -# Change Log azure-storage-file-datalake +# Release History -## Version XX.X.X-beta.X (XXXX-XX-XX) +## 12.0.0-beta.9 (Unreleased) + +## 12.0.0-beta.8 (2019-12-18) - Added SAS generation methods on clients to improve discoverability and convenience of sas. - Mapped StorageErrorException and BlobStorageException to DataLakeStorageException. - Added support for exists method on FileClients and DirectoryClients - Added support for no overwrite by default on min create method on FileClients and DirectoryClients and flush method on FileClients -## Version 12.0.0-beta.7 (2019-12-04) +## 12.0.0-beta.7 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-file-datalake/README.md) and @@ -22,7 +24,7 @@ and - Upgraded to version 1.1.0 of Azure Core. - Upgraded to version 12.1.0 of Azure Storage Blob. -## Version 12.0.0-preview.5 (2019-11-06) +## 12.0.0-preview.5 - Initial Release. Please see the README and wiki for information on the new design. - Support for Azure Data Lake Storage REST APIs. - Support for DataLakeServiceClient: create file system, delete file system, get file systems, and get user delegation key diff --git a/sdk/storage/azure-storage-file-datalake/README.md b/sdk/storage/azure-storage-file-datalake/README.md index 2835909cc2dd..e9a799d860ed 100644 --- a/sdk/storage/azure-storage-file-datalake/README.md +++ b/sdk/storage/azure-storage-file-datalake/README.md @@ -25,7 +25,7 @@ Add a dependency on Azure Storage File Datalake com.azure azure-storage-file-datalake - 12.0.0-beta.7 + 12.0.0-beta.9 ``` [//]: # ({x-version-update-end}) @@ -44,7 +44,7 @@ Netty and include the OkHTTP client in your pom.xml. com.azure azure-storage-file-datalake - 12.0.0-beta.7 + 12.0.0-beta.9 com.azure diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index 0c0a012962f7..5099f03456f5 100644 --- a/sdk/storage/azure-storage-file-datalake/pom.xml +++ b/sdk/storage/azure-storage-file-datalake/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file-datalake - 12.0.0-beta.8 + 12.0.0-beta.9 Microsoft Azure client library for File Storage Data Lake This module contains client library for Microsoft Azure File Storage Data Lake. @@ -55,12 +55,12 @@ com.azure azure-storage-blob - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure azure-core - 1.2.0-beta.1 + 1.1.0 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy index de45e7a54c5c..eb705adca0aa 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy @@ -128,6 +128,9 @@ class APISpec extends Specification { this.interceptorManager = new InterceptorManager(className + fullTestName, testMode) this.resourceNamer = new TestResourceNamer(className + testName, testMode, interceptorManager.getRecordedData()) + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, fullTestName) + // If the test doesn't have the Requires tag record it in live mode. recordLiveMode = specificationContext.getCurrentIteration().getDescription().getAnnotation(Requires.class) == null diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index b0b6251bc8fa..9175ba556157 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,8 +1,11 @@ # Release History -## Version X.X.X (XXXX-XX-XX) + +## 12.1.0-beta.2 (Unreleased) + +## 12.1.0-beta.1 (2019-12-18) - Added SAS generation methods on clients to improve discoverability and convenience of sas. Deprecated setFilePath, setShareName generateSasQueryParameters methods on ShareServiceSasSignatureValues to direct users to using the methods added on clients. -## Version 12.0.0 (2019-12-04) +## 12.0.0 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-file_12.0.0/sdk/storage/azure-storage-file-share/README.md) and @@ -13,8 +16,7 @@ and - Changed return type for forceCloseAllHandles from int to CloseHandlesInfo. - Upgraded to version 1.1.0 of Azure Core. -## Version 12.0.0-preview.5 (2019-10-31) - +## 12.0.0-preview.5 (2019-10-31) - Renamed FileReference to StorageFileItem - Changed response of ShareClient.listFilesAndDirectories FileReference to StorageFileItem - FileUploadRangeFromUrlInfo eTag() changed to getETag() and lastModified() changed to getLastModidified() @@ -41,7 +43,7 @@ and - Renamed FileSasPermission getters to use has prefix - Changed return type for FileClient.downloadWithProperties from Response to FileDownloadResponse and FileAsyncClient.downloadWithProperties from Mono>> to Mono -## Version 12.0.0-preview.4 (2019-10-8) +## 12.0.0-preview.4 (2019-10-8) For details on the Azure SDK for Java (October 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview4-java). This package's @@ -59,7 +61,7 @@ and - Removed SAS token generation APIs from clients, use FileServiceSasSignatureValues to generate SAS tokens. - Removed `SASTokenCredential`, `SASTokenCredentialPolicy` and the corresponding `credential(SASTokenCredential)` method in client builder, and added sasToken(String) instead. -## Version 12.0.0-preview.3 (2019-09-10): +## 12.0.0-preview.3 (2019-09-10) For details on the Azure SDK for Java (September 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). This package's @@ -88,7 +90,7 @@ demonstrate the new API. - Replaced setHttpHeaders with setProperties APIs on sync and async File client. Additionally Allows users to set file SMB properties and file permission. - Added file smb properties and file permission parameters to create APIs on sync and async File and Directory clients. -## Version 12.0.0-preview.2 (2019-08-08) +## 12.0.0-preview.2 (2019-08-08) Version 12.0.0-preview.2 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). For details on the Azure SDK for Java (August 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). diff --git a/sdk/storage/azure-storage-file-share/README.md b/sdk/storage/azure-storage-file-share/README.md index 1aa2cbb76792..1ff0b4733fab 100644 --- a/sdk/storage/azure-storage-file-share/README.md +++ b/sdk/storage/azure-storage-file-share/README.md @@ -24,7 +24,7 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB com.azure azure-storage-file-share - 12.0.0 + 12.1.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -43,7 +43,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-storage-file-share - 12.0.0 + 12.1.0-beta.2 com.azure diff --git a/sdk/storage/azure-storage-file-share/pom.xml b/sdk/storage/azure-storage-file-share/pom.xml index 3930627c6295..69e0f4494d03 100644 --- a/sdk/storage/azure-storage-file-share/pom.xml +++ b/sdk/storage/azure-storage-file-share/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file-share - 12.1.0-beta.1 + 12.1.0-beta.2 Microsoft Azure client library for File Share Storage This module contains client library for Microsoft Azure File Share Storage. @@ -40,12 +40,12 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 com.azure azure-storage-common - 12.2.0-beta.1 + 12.2.0-beta.2 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy index b128c69724a6..10292a61741d 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy @@ -16,7 +16,6 @@ import com.azure.core.util.Configuration import com.azure.core.util.logging.ClientLogger import com.azure.storage.common.StorageSharedKeyCredential import com.azure.storage.file.share.models.ListSharesOptions -import org.junit.jupiter.api.Test import spock.lang.Specification import java.time.Duration @@ -64,6 +63,9 @@ class APISpec extends Specification { connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;" + "AccountKey=atestaccountkey;EndpointSuffix=core.windows.net" } + + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, testName) } /** diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index a1bc15e50951..25f0ce1545eb 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,9 +1,11 @@ # Release History -## Version X.X.X (XXXX-XX-XX) +## 12.2.0-beta.2 (Unreleased) + +## 12.2.0-beta.1 (2019-12-18) - Added SAS generation methods on clients to improve discoverability and convenience of sas. Deprecated setQueueName, generateSasQueryParameters methods on QueueServiceSasSignatureValues to direct users to using the methods added on clients. -## Version 12.1.0 (2019-12-04) +## 12.1.0 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-queue_12.0.0/sdk/storage/azure-storage-queue/README.md) and @@ -12,7 +14,7 @@ and - Added a check in ClientBuilders to enforce HTTPS for bearer token authentication. - Upgraded to version 1.1.0 of Azure Core. -## Version 12.0.0 (2019-10-31) +## 12.0.0 (2019-10-31) - Removed QueueMessage from public API - Removed BaseQueueClientBuilder - Removed QueueClientBuilder and QueueServiceClientBuilder inheritance of BaseQueueClientBuilder @@ -27,7 +29,7 @@ and - Added support for emulator endpoints - Renamed QueueSasPermission getters to use has prefix -## Version 12.0.0-preview.4 (2019-10-8) +## 12.0.0-preview.4 (2019-10-8) For details on the Azure SDK for Java (October 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview4-java). This package's @@ -44,9 +46,7 @@ and - Removed SAS token generation APIs from clients, use QueueServiceSasSignatureValues to generate SAS tokens. - Removed `SASTokenCredential`, `SASTokenCredentialPolicy` and the corresponding `credential(SASTokenCredential)` method in client builder, and added sasToken(String) instead. - - -## Version 12.0.0-preview.3 (2019-09-10) +## 12.0.0-preview.3 (2019-09-10) For details on the Azure SDK for Java (September 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). This package's @@ -69,7 +69,7 @@ and **Breaking changes: New API design** - Changed list responses to `PagedFlux` on async APIs and `PagedIterable` on sync APIs. -## Version 12.0.0-preview.2 (2019-08-08) +## 12.0.0-preview.2 (2019-08-08) Version 12.0.0-preview.2 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). For details on the Azure SDK for Java (August 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index 85392a2694e6..618569a99cab 100644 --- a/sdk/storage/azure-storage-queue/README.md +++ b/sdk/storage/azure-storage-queue/README.md @@ -20,7 +20,7 @@ A single queue message can be up to 64 KB in size, and a queue can contain milli com.azure azure-storage-queue - 12.1.0 + 12.2.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -38,7 +38,7 @@ Netty and include OkHTTP client in your pom.xml. com.azure azure-storage-queue - 12.1.0 + 12.2.0-beta.2 com.azure diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index f690b2b32f8a..f5f837086196 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-queue - 12.2.0-beta.1 + 12.2.0-beta.2 Microsoft Azure client library for Queue Storage This module contains client library for Microsoft Azure Queue Storage. @@ -36,17 +36,17 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 com.azure azure-storage-common - 12.2.0-beta.1 + 12.2.0-beta.2 com.azure azure-core-test - 1.1.0-beta.1 + 1.1.0-beta.2 test diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy index 8645fa1173ac..4fe7f9cab994 100644 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy @@ -59,6 +59,9 @@ class APISpec extends Specification { connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;" + "EndpointSuffix=core.windows.net" } + + // Print out the test name to create breadcrumbs in our test logging in case anything hangs. + System.out.printf("========================= %s.%s =========================%n", className, testName) } /** diff --git a/sdk/template/azure-sdk-template/CHANGELOG.md b/sdk/template/azure-sdk-template/CHANGELOG.md new file mode 100644 index 000000000000..82d3974cdc20 --- /dev/null +++ b/sdk/template/azure-sdk-template/CHANGELOG.md @@ -0,0 +1,14 @@ +# Release History + +## 1.0.4-beta.1 (2019-11-20) + +## Version 1.0.3 (2019-11-18) + +## Version 1.0.3-beta.1 (2019-11-17) + +## Version 1.0.1 (2019-11-17) + +## Version 1.0.1-beta.1 (2019-11-17) + +## Version 1.0.2 (2019-08-15) +- Initial release. Please see the README and wiki for information on the new design. diff --git a/sdk/template/azure-sdk-template/pom.xml b/sdk/template/azure-sdk-template/pom.xml index 3ab247291746..d61131d1e5f9 100644 --- a/sdk/template/azure-sdk-template/pom.xml +++ b/sdk/template/azure-sdk-template/pom.xml @@ -31,7 +31,7 @@ com.azure azure-core - 1.2.0-beta.1 + 1.1.0 junit diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md new file mode 100644 index 000000000000..baa9b42aca21 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md @@ -0,0 +1,14 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +For details on the Azure SDK for Java (January 2020 Preview) release refer to the [release announcement](). +- Initial release of this module. +- Added support for subscription key and AAD authentication for both synchronous and asynchronous clients. +- Added Detect Language, Recognize Entity, Recognize PII entity, Recognize Linking Entity, Analyze Sentiment APIs. + +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-ai-textanalytics_1.0.0-beta.1/sdk/textanalytics/azure-ai-textanalytics/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-ai-textanalytics_1.0.0-beta.1/sdk/textanalytics/azure-ai-textanalytics/src/samples) +demonstrate the new API. diff --git a/sdk/textanalytics/azure-ai-textanalytics/README.md b/sdk/textanalytics/azure-ai-textanalytics/README.md new file mode 100644 index 000000000000..c43422645567 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/README.md @@ -0,0 +1,389 @@ +# Azure Text Analytics client library for Java +Text Analytics is a cloud-based service that provides advanced natural language processing over raw text, +and includes six main functions: + +- Language Detection +- Sentiment Analysis +- Key Phrase Extraction +- Named Entity Recognition +- Recognition of Personally Identifiable Information +- Linked Entity Recognition + +[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_reference_doc] | [Product Documentation][product_documentation] | [Samples][samples_readme] + +## Getting started + +### Prerequisites +- Java Development Kit (JDK) with version 8 or above +- [Azure Subscription][azure_subscription] +- [Cognitive Services or Text Analytics account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows) to use this package. + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-ai-textanalytics;current}) +```xml + + com.azure + azure-ai-textanalytics + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Default HTTP Client +All client libraries, by default, use Netty HTTP client. Adding the above dependency will automatically configure +Text Analytics to use Netty HTTP client. + +[//]: # ({x-version-update-start;com.azure:azure-core-http-netty;dependency}) +```xml + + com.azure + azure-core-http-netty + 1.1.0 + +``` +[//]: # ({x-version-update-end}) + +### Alternate HTTP Client +If, instead of Netty it is preferable to use OkHTTP, there is a HTTP client available for that too. Exclude the default +Netty and include OkHTTP client in your pom.xml. + +[//]: # ({x-version-update-start;com.azure:azure-ai-textanalytics;current}) +```xml + + + com.azure + azure-ai-textanalytics + 1.0.0-beta.1 + + + com.azure + azure-core-http-netty + + + +``` +[//]: # ({x-version-update-end}) + +[//]: # ({x-version-update-start;com.azure:azure-core-http-okhttp;dependency}) +```xml + + + com.azure + azure-core-http-okhttp + 1.0.0 + +``` +[//]: # ({x-version-update-end}) + +### Configuring HTTP Clients +When an HTTP client is included on the classpath, as shown above, it is not necessary to specify it in the client library [builders](#create-a-client), unless you want to customize the HTTP client in some fashion. If this is desired, the `httpClient` builder method is often available to achieve just this, by allowing users to provide a custom (or customized) `com.azure.core.http.HttpClient` instances. + +For starters, by having the Netty or OkHTTP dependencies on your classpath, as shown above, you can create new instances of these `HttpClient` types using their builder APIs. For example, here is how you would create a Netty HttpClient instance: + + +```java +HttpClient client = new NettyAsyncHttpClientBuilder() + .port(8080) + .wiretap(true) + .build(); +``` + +### Default SSL library +All client libraries, by default, use the Tomcat-native Boring SSL library to enable native-level performance for SSL operations. The Boring SSL library is an uber jar containing native libraries for Linux / macOS / Windows, and provides better performance compared to the default SSL implementation within the JDK. For more information, including how to reduce the dependency size, refer to the [performance tuning][performance_tuning] section of the wiki. + +### Create a Text Analytics resource +Text Analytics supports both [multi-service and single-service access](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows). Create a Cognitive Services resource if you plan +to access multiple cognitive services under a single endpoint/key. For Text Analytics access only, create a Text Analytics resource. + +You can create either resource using the +[Azure Portal](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#create-a-new-azure-cognitive-services-resource) +or [Azure CLI](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli?tabs=windows). +Below is an example of how you can create a Text Analytics resource using the CLI: + +```bash +# Create a new resource group to hold the text analytics resource - +# if using an existing resource group, skip this step +az group create --name my-resource-group --location westus2 +``` + +```bash +# Create text analytics +az cognitiveservices account create \ + --name text-analytics-resource \ + --resource-group my-resource-group \ + --kind TextAnalytics \ + --sku F0 \ + --location westus2 \ + --yes +``` +### Authenticate the client +In order to interact with the Text Analytics service, you'll need to create an instance of the [TextAnalyticsClient](#create-a-client) class. You would need an **endpoint** and **subscription key** to instantiate a client object. + +#### Get credentials +##### Types of credentials +The `subscriptionKey` parameter may be provided as the subscription key to your resource or as a token from Azure Active Directory. +See the full details regarding [authentication](https://docs.microsoft.com/azure/cognitive-services/authentication) of +cognitive services. + +1. To use a [subscription key](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource), + provide the key as a string. This can be found in the Azure Portal under the "Quickstart" + section or by running the following Azure CLI command: + + ```bash + az cognitiveservices account keys list --name "resource-name" --resource-group "resource-group-name" + ``` + + Use the key as the credential parameter to authenticate the client: + + ```java + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + ``` + +2. To use an [Azure Active Directory (AAD) token credential](https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory), + provide an instance of the desired credential type obtained from the + [azure-identity](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#credentials) library. + Note that regional endpoints do not support AAD authentication. Create a [custom subdomain](https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain) + name for your resource in order to use this type of authentication. + + Authentication with AAD requires some initial setup: + * [Install azure-identity](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#install-the-package) + * [Register a new AAD application](https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal) + * [Grant access](https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal) to Text Analytics by assigning the `"Cognitive Services User"` role to your service principal. + + After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#credentials) from azure.identity to use. + As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/identity/azure-identity#defaultazurecredential) + can be used to authenticate the client: + + Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: + AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET + + Use the returned token credential to authenticate the client: + + ```java + TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .endpoint(ENDPOINT) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + ``` + +#### Create a Client +The Azure Text Analytics client library for Java allows you to engage with the Text Analytics service to +analyze sentiment, recognize entities, detect language, and extract key phrases from text. +To create a client object, you will need the cognitive services or text analytics endpoint to +your resource and a subscription key that allows you access: + + +```java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); +``` + +## Key concepts + +### Text Input +A text input, sometimes called a `document`, is a single unit of input to be analyzed by the predictive models +in the Text Analytics service. Operations on Text Analytics client may take a single text input or a collection +of inputs to be analyzed as a batch. + +### Operation Result +An operation result, such as `AnalyzeSentimentResult`, is the result of a Text Analytics operation, containing a +prediction or predictions about a single text input. An operation's result type also may optionally include information +about the input document and how it was processed. + +### Operation Result Collection +An operation result collection, such as `DocumentResultCollection`, which is the collection of +the result of a Text Analytics analyzing sentiment operation. `DocumentResultCollection` includes the model version of +the operation and statistics of the batch documents. Since `DocumentResultCollection` extends `IterableStream`, +the list of item can be retrieved by streaming or iterating the list. + +### Operation Overloads +For each supported operation, the Text Analytics client provides method overloads to take a single text input, a batch +of text inputs as strings, or a batch of either `TextDocumentInput` or `DetectLanguageInput` objects. The overload +taking the `TextDocumentInput` or `DetectLanguageInput` batch allows callers to give each document a unique ID, or +indicate that the documents in the batch are written in different languages. + +The following are types of text analysis that the service offers: + +1. [Sentiment Analysis](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis) + + Use sentiment analysis to find out what customers think of your brand or topic by analyzing raw text for clues about positive or negative sentiment. + Scores closer to `1` indicate positive sentiment, while scores closer to `0` indicate negative sentiment. + Sentiment analysis returns scores and labels at a document and sentence level. + +2. [Named Entity Recognition](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking) + + Use named entity recognition (NER) to identify different entities in text and categorize them into pre-defined classes, or types. + Entity recognition in the client library provides three different methods depending on what you are interested in. + * `recognizeEntities()` can be used to identify and categorize entities in your text as people, places, organizations, date/time, quantities, percentages, currencies, and more. + * `recognizePiiEntities()` can be used to recognize personally identifiable information such as SSNs and bank account numbers. + * `recognizeLinkedEntities()` can be used to identify and disambiguate the identity of an entity found in text (For example, determining whether + "Mars" is being used as the planet or as the Roman god of war). This process uses Wikipedia as the knowledge base to which recognized entities are linked. + + See a full list of [Named Entity Recognition Types](https://docs.microsoft.com/azure/cognitive-services/text-analytics/named-entity-types?tabs=personal). + +3. [Language Detection](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-language-detection) + + Detect the language of the input text and report a single language code for every document submitted on the request. + The language code is paired with a score indicating the strength of the score. + A wide range of languages, variants, dialects, and some regional/cultural languages are supported - + see [supported languages](https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support#language-detection) for full details. + +4. [Key Phrase Extraction](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-keyword-extraction) + + Extract key phrases to quickly identify the main points in text. + For example, for the input text "The food was delicious and there were wonderful staff", the main talking points returned: "food" and "wonderful staff". + +See [Language and regional support](https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support) for what is currently available for each operation. + +## Examples +The following sections provide several code snippets covering some of the most common text analytics tasks, including: + +### Text Analytics Client +Text analytics support both synchronous and asynchronous client creation by using +`TextAnalyticsClientBuilder`, + + +``` java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); +``` + +``` java +TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildAsyncClient(); +``` + +### Detect language + +```java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + +String inputText = "Bonjour tout le monde"; + +for (DetectedLanguage detectedLanguage : textAnalyticsClient.detectLanguage(inputText).getDetectedLanguages()) { + System.out.printf("Detected languages name: %s, ISO 6391 Name: %s, Score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); +} +``` + +### Recognize entity + +```java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + +String text = "Satya Nadella is the CEO of Microsoft"; + +for (NamedEntity entity : textAnalyticsClient.recognizeEntities(text).getNamedEntities()) { + System.out.printf( + "Recognized Named Entity: %s, Type: %s, Subtype: %s, Score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype(), + entity.getScore()); +} +``` + +### Recognize PII(Personally Identifiable Information) entity + +```java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + +// The text that need be analysed. +String text = "My SSN is 555-55-5555"; + +for (NamedEntity entity : textAnalyticsClient.recognizePiiEntities(text).getNamedEntities()) { + System.out.printf( + "Recognized PII Entity: %s, Type: %s, Subtype: %s, Score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype(), + entity.getScore()); +} +``` + +### Recognize linked entity + + +```java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + +// The text that need be analysed. +String text = "Old Faithful is a geyser at Yellowstone Park."; + +for (LinkedEntity linkedEntity : textAnalyticsClient.recognizeLinkedEntities(text).getLinkedEntities()) { + System.out.printf("Recognized Linked Entity: %s, Url: %s, Data Source: %s.%n", + linkedEntity.getName(), + linkedEntity.getUrl(), + linkedEntity.getDataSource()); +} +``` + +### Analyze sentiment + + +```java +TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + +String text = "The hotel was dark and unclean."; + +for (TextSentiment textSentiment : textAnalyticsClient.analyzeSentiment(text).getSentenceSentiments()) { + System.out.printf( + "Analyzed Sentence Sentiment class: %s.%n", + textSentiment.getTextSentimentClass()); +} +``` + +## Troubleshooting +## General + +## Next steps +- Samples are explained in detail [here][samples_readme]. + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a [Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution. + +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 repos 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 [opencode@microsoft.com][coc_contact] with any additional questions or comments. + + +[azure_subscription]: https://azure.microsoft.com/free +[api_reference_doc]: https://azure.github.io/azure-sdk-for-java/textanalytics.html +[cla]: https://cla.microsoft.com +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com +[package]: https://mvnrepository.com/artifact/com.azure/azure-ai-textanalytics +[product_documentation]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview +[samples_readme]: src/samples/README.md +[source_code]: src + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Ftextanalytics%2Fazure-ai-textanalytics%2FREADME.png) diff --git a/sdk/textanalytics/azure-ai-textanalytics/pom.xml b/sdk/textanalytics/azure-ai-textanalytics/pom.xml new file mode 100644 index 000000000000..546713414963 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../../pom.client.xml + + + com.azure + azure-ai-textanalytics + 1.0.0-beta.1 + + Microsoft Azure client library for Text Analytics + This package contains the Microsoft Azure Cognitive Services Text Analytics SDK. + https://github.com/Azure/azure-sdk-for-java + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + + com.azure + azure-core-http-netty + 1.1.0 + + + + + com.azure + azure-core-test + 1.1.0-beta.2 + test + + + org.junit.jupiter + junit-jupiter-api + 5.4.2 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.4.2 + test + + + com.azure + azure-identity + 1.0.1 + test + + + diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java new file mode 100644 index 000000000000..6c3afcff0eaf --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.models.DocumentError; +import com.azure.ai.textanalytics.implementation.models.DocumentSentiment; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; +import com.azure.ai.textanalytics.implementation.models.SentimentConfidenceScorePerLabel; +import com.azure.ai.textanalytics.implementation.models.SentimentResponse; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.models.TextSentiment; +import com.azure.ai.textanalytics.models.TextSentimentClass; +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 reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.Transforms.mapByIndex; +import static com.azure.ai.textanalytics.Transforms.toBatchStatistics; +import static com.azure.ai.textanalytics.Transforms.toMultiLanguageInput; +import static com.azure.ai.textanalytics.Transforms.toTextAnalyticsError; +import static com.azure.ai.textanalytics.Transforms.toTextDocumentStatistics; + +/** + * Helper class for managing sentiment analysis endpoint. + */ +class AnalyzeSentimentAsyncClient { + private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); + private final TextAnalyticsClientImpl service; + + /** + * Create a {@code AnalyzeSentimentAsyncClient} that sends requests to the Text Analytics services's sentiment + * analysis endpoint. + * + * @param service The proxy service used to perform REST calls. + */ + AnalyzeSentimentAsyncClient(TextAnalyticsClientImpl service) { + this.service = service; + } + + Mono> analyzeSentimentWithResponse(String text, String language, Context context) { + Objects.requireNonNull(text, "'text' cannot be null."); + + return analyzeBatchSentimentWithResponse( + Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) + .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); + } + + Mono>> analyzeSentimentWithResponse( + List textInputs, String language, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + List documentInputs = mapByIndex(textInputs, (index, value) -> + new TextDocumentInput(index, value, language)); + return analyzeBatchSentimentWithResponse(documentInputs, null, context); + } + + Mono>> analyzeBatchSentimentWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + final MultiLanguageBatchInput batchInput = new MultiLanguageBatchInput() + .setDocuments(toMultiLanguageInput(textInputs)); + return service.sentimentWithRestResponseAsync( + batchInput, + options == null ? null : options.getModelVersion(), + options == null ? null : options.showStatistics(), context) + .doOnSubscribe(ignoredValue -> logger.info("A batch of text sentiment input - {}", textInputs.toString())) + .doOnSuccess(response -> logger.info("A batch of text sentiment output - {}", response)) + .doOnError(error -> logger.warning("Failed to analyze text sentiment - {}", error)) + .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); + } + + /** + * Helper method to convert the service response of {@link SentimentResponse} to {@link DocumentResultCollection}. + * + * @param sentimentResponse the {@link SentimentResponse} returned by the service. + * + * @return the {@link DocumentResultCollection} of {@link AnalyzeSentimentResult} to be returned by the SDK. + */ + private DocumentResultCollection toDocumentResultCollection( + final SentimentResponse sentimentResponse) { + List analyzeSentimentResults = new ArrayList<>(); + for (DocumentSentiment documentSentiment : sentimentResponse.getDocuments()) { + analyzeSentimentResults.add(convertToTextSentimentResult(documentSentiment)); + } + for (DocumentError documentError : sentimentResponse.getErrors()) { + final com.azure.ai.textanalytics.models.TextAnalyticsError error = + toTextAnalyticsError(documentError.getError()); + analyzeSentimentResults.add(new AnalyzeSentimentResult(documentError.getId(), null, + error, null, null)); + } + return new DocumentResultCollection<>(analyzeSentimentResults, + sentimentResponse.getModelVersion(), sentimentResponse.getStatistics() == null ? null + : toBatchStatistics(sentimentResponse.getStatistics())); + } + + /** + * Helper method to convert the service response of {@link DocumentSentiment} to {@link AnalyzeSentimentResult}. + * + * @param documentSentiment the {@link DocumentSentiment} returned by the service. + * + * @return the {@link AnalyzeSentimentResult} to be returned by the SDK. + */ + private AnalyzeSentimentResult convertToTextSentimentResult(final DocumentSentiment documentSentiment) { + // Document text sentiment + final TextSentimentClass documentSentimentClass = TextSentimentClass.fromString(documentSentiment. + getSentiment().toString()); + if (documentSentimentClass == null) { + // Not throw exception for an invalid Sentiment type because we should not skip processing the + // other response. It is a service issue. + logger.logExceptionAsWarning( + new RuntimeException(String.format("'%s' is not valid text sentiment.", + documentSentiment.getSentiment()))); + } + final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getDocumentScores(); + + // Sentence text sentiment + final List sentenceSentimentTexts = documentSentiment.getSentences().stream() + .map(sentenceSentiment -> { + TextSentimentClass sentimentClass = TextSentimentClass.fromString(sentenceSentiment + .getSentiment().toString()); + if (sentimentClass == null) { + // Not throw exception for an invalid Sentiment type because we should not skip processing the + // other response. It is a service issue. + logger.logExceptionAsWarning( + new RuntimeException(String.format("'%s' is not valid text sentiment.", + sentenceSentiment.getSentiment()))); + } + SentimentConfidenceScorePerLabel confidenceScorePerSentence = sentenceSentiment.getSentenceScores(); + + return new TextSentiment(sentimentClass, confidenceScorePerSentence.getNegative(), + confidenceScorePerSentence.getNeutral(), confidenceScorePerSentence.getPositive(), + sentenceSentiment.getLength(), sentenceSentiment.getOffset()); + + }).collect(Collectors.toList()); + + return new AnalyzeSentimentResult(documentSentiment.getId(), + documentSentiment.getStatistics() == null ? null + : toTextDocumentStatistics(documentSentiment.getStatistics()), null, + new TextSentiment(documentSentimentClass, confidenceScorePerLabel.getNegative(), + confidenceScorePerLabel.getNeutral(), confidenceScorePerLabel.getPositive(), + sentenceSentimentTexts.stream().mapToInt(TextSentiment::getLength).sum(), 0), + sentenceSentimentTexts); + } + +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java new file mode 100644 index 000000000000..af2ab897ac65 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.models.DocumentError; +import com.azure.ai.textanalytics.implementation.models.DocumentLanguage; +import com.azure.ai.textanalytics.implementation.models.LanguageBatchInput; +import com.azure.ai.textanalytics.implementation.models.LanguageInput; +import com.azure.ai.textanalytics.implementation.models.LanguageResult; +import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +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 reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.Transforms.mapByIndex; + +/** + * Helper class for managing detect language endpoint. + */ +class DetectLanguageAsyncClient { + private final ClientLogger logger = new ClientLogger(DetectLanguageAsyncClient.class); + private final TextAnalyticsClientImpl service; + + /** + * Create a {@code DetectLanguageAsyncClient} that sends requests to the Text Analytics services's detect language + * endpoint. + * + * @param service The proxy service used to perform REST calls. + */ + DetectLanguageAsyncClient(TextAnalyticsClientImpl service) { + this.service = service; + } + + Mono> detectLanguageWithResponse(String text, String countryHint, Context context) { + Objects.requireNonNull(text, "'text' cannot be null."); + List languageInputs = Collections.singletonList(new DetectLanguageInput("0", + text, countryHint)); + return detectBatchLanguagesWithResponse(languageInputs, null, context).map(response -> + new SimpleResponse<>(response, response.getValue().iterator().next())); + } + + Mono>> detectLanguagesWithResponse(List textInputs, + String countryHint, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + List detectLanguageInputs = mapByIndex(textInputs, (index, value) -> + new DetectLanguageInput(index, value, countryHint)); + + return detectBatchLanguagesWithResponse(detectLanguageInputs, null, context); + } + + Mono>> detectBatchLanguagesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + final LanguageBatchInput languageBatchInput = new LanguageBatchInput() + .setDocuments(textInputs.stream().map(detectLanguageInput -> new LanguageInput() + .setId(detectLanguageInput.getId()).setText(detectLanguageInput.getText()) + .setCountryHint(detectLanguageInput.getCountryHint())).collect(Collectors.toList())); + + return service.languagesWithRestResponseAsync( + languageBatchInput, options == null ? null : options.getModelVersion(), + options == null ? null : options.showStatistics(), context) + .doOnSubscribe(ignoredValue -> logger.info("A batch of language input - {}", textInputs.toString())) + .doOnSuccess(response -> logger.info("A batch of detected language output - {}", response.getValue())) + .doOnError(error -> logger.warning("Failed to detect languages - {}", error)) + .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); + } + + /** + * Helper method to convert the service response of {@link LanguageResult} to {@link DocumentResultCollection}. + * + * @param languageResult the {@link LanguageResult} returned by the service. + * + * @return the {@link DocumentResultCollection} of {@link DetectLanguageResult} to be returned by the SDK. + */ + private DocumentResultCollection toDocumentResultCollection( + final LanguageResult languageResult) { + + final List detectLanguageResults = new ArrayList<>(); + for (DocumentLanguage documentLanguage : languageResult.getDocuments()) { + DetectedLanguage primaryLanguage = null; + if (documentLanguage.getDetectedLanguages().size() >= 1) { + com.azure.ai.textanalytics.implementation.models.DetectedLanguage detectedLanguageResult = + documentLanguage.getDetectedLanguages().get(0); + primaryLanguage = new DetectedLanguage(detectedLanguageResult.getName(), + detectedLanguageResult.getIso6391Name(), detectedLanguageResult.getScore()); + } + detectLanguageResults.add(new DetectLanguageResult(documentLanguage.getId(), + documentLanguage.getStatistics() == null + ? null : Transforms.toTextDocumentStatistics(documentLanguage.getStatistics()), + null, + primaryLanguage, + documentLanguage.getDetectedLanguages().stream().map(detectedLanguage -> + new DetectedLanguage(detectedLanguage.getName(), detectedLanguage.getIso6391Name(), + detectedLanguage.getScore())).collect(Collectors.toList()))); + } + + for (DocumentError documentError : languageResult.getErrors()) { + com.azure.ai.textanalytics.models.TextAnalyticsError error = + Transforms.toTextAnalyticsError(documentError.getError()); + detectLanguageResults.add( + new DetectLanguageResult(documentError.getId(), null, error, null, null)); + } + + return new DocumentResultCollection<>(detectLanguageResults, languageResult.getModelVersion(), + languageResult.getStatistics() == null ? null + : Transforms.toBatchStatistics(languageResult.getStatistics())); + } + +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java new file mode 100644 index 000000000000..05c76b9d2716 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.models.DocumentError; +import com.azure.ai.textanalytics.implementation.models.DocumentKeyPhrases; +import com.azure.ai.textanalytics.implementation.models.KeyPhraseResult; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +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 reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import static com.azure.ai.textanalytics.Transforms.mapByIndex; +import static com.azure.ai.textanalytics.Transforms.toBatchStatistics; +import static com.azure.ai.textanalytics.Transforms.toMultiLanguageInput; +import static com.azure.ai.textanalytics.Transforms.toTextAnalyticsError; +import static com.azure.ai.textanalytics.Transforms.toTextDocumentStatistics; + +/** + * Helper class for managing extract keyphrase endpoint. + */ +class ExtractKeyPhraseAsyncClient { + private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); + private final TextAnalyticsClientImpl service; + + /** + * Create a {@code ExtractKeyPhraseAsyncClient} that sends requests to the Text Analytics services's extract + * keyphrase endpoint. + * + * @param service The proxy service used to perform REST calls. + */ + ExtractKeyPhraseAsyncClient(TextAnalyticsClientImpl service) { + this.service = service; + } + + Mono> extractKeyPhrasesWithResponse(String text, String language, + Context context) { + Objects.requireNonNull(text, "'text' cannot be null."); + + return extractBatchKeyPhrasesWithResponse( + Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) + .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); + } + + Mono>> extractKeyPhrasesWithResponse( + List textInputs, String language, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + List documentInputs = mapByIndex(textInputs, (index, value) -> + new TextDocumentInput(index, value, language)); + return extractBatchKeyPhrasesWithResponse(documentInputs, null, context); + } + + Mono>> extractBatchKeyPhrasesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + final MultiLanguageBatchInput batchInput = new MultiLanguageBatchInput() + .setDocuments(toMultiLanguageInput(textInputs)); + return service.keyPhrasesWithRestResponseAsync( + batchInput, + options == null ? null : options.getModelVersion(), + options == null ? null : options.showStatistics(), context) + .doOnSubscribe(ignoredValue -> logger.info("A batch of key phrases input - {}", textInputs.toString())) + .doOnSuccess(response -> logger.info("A batch of key phrases output - {}", response.getValue())) + .doOnError(error -> logger.warning("Failed to extract key phrases - {}", error)) + .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); + } + + /** + * Helper method to convert the service response of {@link KeyPhraseResult} to {@link DocumentResultCollection}. + * + * @param keyPhraseResult the {@link KeyPhraseResult} returned by the service. + * + * @return the {@link DocumentResultCollection} of {@link KeyPhraseResult} to be returned by the SDK. + */ + private DocumentResultCollection toDocumentResultCollection( + final KeyPhraseResult keyPhraseResult) { + List keyPhraseResultList = new ArrayList<>(); + for (DocumentKeyPhrases documentKeyPhrases : keyPhraseResult.getDocuments()) { + keyPhraseResultList.add(new ExtractKeyPhraseResult(documentKeyPhrases.getId(), + documentKeyPhrases.getStatistics() == null ? null + : toTextDocumentStatistics(documentKeyPhrases.getStatistics()), null, + documentKeyPhrases.getKeyPhrases())); + } + + for (DocumentError documentError : keyPhraseResult.getErrors()) { + final com.azure.ai.textanalytics.models.TextAnalyticsError error = + toTextAnalyticsError(documentError.getError()); + keyPhraseResultList.add(new ExtractKeyPhraseResult(documentError.getId(), null, error, null)); + } + + return new DocumentResultCollection<>(keyPhraseResultList, + keyPhraseResult.getModelVersion(), keyPhraseResult.getStatistics() == null ? null + : toBatchStatistics(keyPhraseResult.getStatistics())); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java new file mode 100644 index 000000000000..9a12fcfb3661 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.models.DocumentEntities; +import com.azure.ai.textanalytics.implementation.models.DocumentError; +import com.azure.ai.textanalytics.implementation.models.EntitiesResult; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +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 reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.Transforms.toTextAnalyticsError; +import static com.azure.ai.textanalytics.Transforms.toTextDocumentStatistics; +import static com.azure.ai.textanalytics.Transforms.toBatchStatistics; +import static com.azure.ai.textanalytics.Transforms.mapByIndex; + +/** + * Helper class for managing recognize entity endpoint. + */ +class RecognizeEntityAsyncClient { + private final ClientLogger logger = new ClientLogger(RecognizeEntityAsyncClient.class); + private final TextAnalyticsClientImpl service; + + /** + * Create a {@code RecognizeEntityAsyncClient} that sends requests to the Text Analytics services's recognize entity + * endpoint. + * + * @param service The proxy service used to perform REST calls. + */ + RecognizeEntityAsyncClient(TextAnalyticsClientImpl service) { + this.service = service; + } + + Mono> recognizeEntitiesWithResponse(String text, String language, + Context context) { + Objects.requireNonNull(text, "'text' cannot be null."); + + return recognizeBatchEntitiesWithResponse( + Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) + .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); + } + + Mono>> recognizeEntitiesWithResponse( + List textInputs, String language, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + List documentInputs = mapByIndex(textInputs, (index, value) -> + new TextDocumentInput(index, value, language)); + return recognizeBatchEntitiesWithResponse(documentInputs, null, context); + } + + Mono>> recognizeBatchEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + final MultiLanguageBatchInput batchInput = new MultiLanguageBatchInput() + .setDocuments(Transforms.toMultiLanguageInput(textInputs)); + return service.entitiesRecognitionGeneralWithRestResponseAsync( + batchInput, + options == null ? null : options.getModelVersion(), + options == null ? null : options.showStatistics(), context) + .doOnSubscribe(ignoredValue -> logger.info("A batch of named entities input - {}", textInputs.toString())) + .doOnSuccess(response -> logger.info("A batch of named entities output - {}", response.getValue())) + .doOnError(error -> logger.warning("Failed to recognize named entities - {}", error)) + .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); + } + + /** + * Helper method to convert the service response of {@link EntitiesResult} to {@link DocumentResultCollection}. + * + * @param entitiesResult the {@link EntitiesResult} returned by the service. + * + * @return the {@link DocumentResultCollection} of {@link DetectLanguageResult} to be returned by the SDK. + */ + private DocumentResultCollection toDocumentResultCollection( + final EntitiesResult entitiesResult) { + List recognizeEntitiesResults = new ArrayList<>(); + for (DocumentEntities documentEntities : entitiesResult.getDocuments()) { + recognizeEntitiesResults.add(new RecognizeEntitiesResult(documentEntities.getId(), + documentEntities.getStatistics() == null ? null + : toTextDocumentStatistics(documentEntities.getStatistics()), + null, documentEntities.getEntities().stream().map(entity -> + new NamedEntity(entity.getText(), entity.getType(), entity.getSubtype(), entity.getOffset(), + entity.getLength(), entity.getScore())).collect(Collectors.toList()))); + } + + for (DocumentError documentError : entitiesResult.getErrors()) { + final com.azure.ai.textanalytics.models.TextAnalyticsError error = + toTextAnalyticsError(documentError.getError()); + recognizeEntitiesResults.add(new RecognizeEntitiesResult(documentError.getId(), null, error, null)); + } + + return new DocumentResultCollection<>(recognizeEntitiesResults, + entitiesResult.getModelVersion(), entitiesResult.getStatistics() == null ? null + : toBatchStatistics(entitiesResult.getStatistics())); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java new file mode 100644 index 000000000000..9d87ab08de67 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.models.DocumentError; +import com.azure.ai.textanalytics.implementation.models.DocumentLinkedEntities; +import com.azure.ai.textanalytics.implementation.models.EntityLinkingResult; +import com.azure.ai.textanalytics.implementation.models.LinkedEntity; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.LinkedEntityMatch; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +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 reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.Transforms.mapByIndex; +import static com.azure.ai.textanalytics.Transforms.toBatchStatistics; +import static com.azure.ai.textanalytics.Transforms.toMultiLanguageInput; +import static com.azure.ai.textanalytics.Transforms.toTextAnalyticsError; +import static com.azure.ai.textanalytics.Transforms.toTextDocumentStatistics; + +/** + * Helper class for managing recognize linked entity endpoint. + */ +class RecognizeLinkedEntityAsyncClient { + private final ClientLogger logger = new ClientLogger(RecognizeLinkedEntityAsyncClient.class); + private final TextAnalyticsClientImpl service; + + /** + * Create a {@code RecognizeLinkedEntityAsyncClient} that sends requests to the Text Analytics services's recognize + * linked entity endpoint. + * + * @param service The proxy service used to perform REST calls. + */ + RecognizeLinkedEntityAsyncClient(TextAnalyticsClientImpl service) { + this.service = service; + } + + Mono> recognizeLinkedEntitiesWithResponse(String text, String language, + Context context) { + Objects.requireNonNull(text, "'text' cannot be null."); + + return recognizeBatchLinkedEntitiesWithResponse( + Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) + .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); + } + + Mono>> recognizeLinkedEntitiesWithResponse( + List textInputs, String language, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + List documentInputs = mapByIndex(textInputs, (index, value) -> + new TextDocumentInput(index, value, language)); + return recognizeBatchLinkedEntitiesWithResponse(documentInputs, null, context); + } + + Mono>> recognizeBatchLinkedEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + final MultiLanguageBatchInput batchInput = new MultiLanguageBatchInput() + .setDocuments(toMultiLanguageInput(textInputs)); + return service.entitiesLinkingWithRestResponseAsync( + batchInput, + options == null ? null : options.getModelVersion(), + options == null ? null : options.showStatistics(), context) + .doOnSubscribe(ignoredValue -> logger.info("A batch of linked entities input - {}", textInputs.toString())) + .doOnSuccess(response -> logger.info("A batch of linked entities output - {}", response.getValue())) + .doOnError(error -> logger.warning("Failed to recognize linked entities - {}", error)) + .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); + } + + + private List mapLinkedEntity(List linkedEntities) { + List linkedEntitiesList = new ArrayList<>(); + for (LinkedEntity linkedEntity : linkedEntities) { + linkedEntitiesList.add(new com.azure.ai.textanalytics.models.LinkedEntity(linkedEntity.getName(), + linkedEntity.getMatches().stream().map(match -> + new LinkedEntityMatch(match.getText(), match.getScore(), match.getLength(), + match.getOffset())).collect(Collectors.toList()), linkedEntity.getLanguage(), + linkedEntity.getId(), linkedEntity.getUrl(), linkedEntity.getDataSource())); + } + return linkedEntitiesList; + } + + /** + * Helper method to convert the service response of {@link EntityLinkingResult} to {@link DocumentResultCollection}. + * + * @param entityLinkingResult the {@link EntityLinkingResult} returned by the service. + * + * @return the {@link DocumentResultCollection} of {@link RecognizeLinkedEntitiesResult} to be returned by the SDK. + */ + private DocumentResultCollection toDocumentResultCollection( + final EntityLinkingResult entityLinkingResult) { + List linkedEntitiesResults = new ArrayList<>(); + for (DocumentLinkedEntities documentLinkedEntities : entityLinkingResult.getDocuments()) { + linkedEntitiesResults.add(new RecognizeLinkedEntitiesResult(documentLinkedEntities.getId(), + documentLinkedEntities.getStatistics() == null ? null + : toTextDocumentStatistics(documentLinkedEntities.getStatistics()), + null, mapLinkedEntity(documentLinkedEntities.getEntities()))); + } + for (DocumentError documentError : entityLinkingResult.getErrors()) { + final com.azure.ai.textanalytics.models.TextAnalyticsError error = + toTextAnalyticsError(documentError.getError()); + linkedEntitiesResults.add(new RecognizeLinkedEntitiesResult(documentError.getId(), null, error, null)); + } + + return new DocumentResultCollection<>(linkedEntitiesResults, + entityLinkingResult.getModelVersion(), entityLinkingResult.getStatistics() == null ? null + : toBatchStatistics(entityLinkingResult.getStatistics())); + } + + +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java new file mode 100644 index 000000000000..781432dbd2c9 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.models.DocumentEntities; +import com.azure.ai.textanalytics.implementation.models.DocumentError; +import com.azure.ai.textanalytics.implementation.models.EntitiesResult; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +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 reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.Transforms.mapByIndex; +import static com.azure.ai.textanalytics.Transforms.toBatchStatistics; +import static com.azure.ai.textanalytics.Transforms.toMultiLanguageInput; +import static com.azure.ai.textanalytics.Transforms.toTextAnalyticsError; +import static com.azure.ai.textanalytics.Transforms.toTextDocumentStatistics; + +/** + * Helper class for managing recognize pii entity endpoint. + */ +class RecognizePiiEntityAsyncClient { + private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); + private final TextAnalyticsClientImpl service; + + /** + * Create a {@code RecognizePiiEntityAsyncClient} that sends requests to the Text Analytics services's recognize pii + * entity endpoint. + * + * @param service The proxy service used to perform REST calls. + */ + RecognizePiiEntityAsyncClient(TextAnalyticsClientImpl service) { + this.service = service; + } + + Mono> recognizePiiEntitiesWithResponse(String text, String language, + Context context) { + Objects.requireNonNull(text, "'text' cannot be null."); + + return recognizeBatchPiiEntitiesWithResponse( + Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) + .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); + } + + Mono>> recognizePiiEntitiesWithResponse( + List textInputs, String language, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + + List documentInputs = mapByIndex(textInputs, (index, value) -> + new TextDocumentInput(index, value, language)); + return recognizeBatchPiiEntitiesWithResponse(documentInputs, null, context); + } + + Mono>> recognizeBatchPiiEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); + final MultiLanguageBatchInput batchInput = new MultiLanguageBatchInput() + .setDocuments(toMultiLanguageInput(textInputs)); + return service.entitiesRecognitionPiiWithRestResponseAsync( + batchInput, + options == null ? null : options.getModelVersion(), + options == null ? null : options.showStatistics(), context) + .doOnSubscribe(ignoredValue -> logger.info("A batch of PII entities input - {}", textInputs.toString())) + .doOnSuccess(response -> logger.info("A batch of PII entities output - {}", response.getValue())) + .doOnError(error -> logger.warning("Failed to recognize PII entities - {}", error)) + .map(response -> new SimpleResponse<>(response, toPiiDocumentResultCollection(response.getValue()))); + } + + /** + * Helper method to convert the service response of {@link EntitiesResult} to {@link DocumentResultCollection}. + * + * @param entitiesResult the {@link EntitiesResult} returned by the service. + * + * @return the {@link DocumentResultCollection} of {@link RecognizePiiEntitiesResult} to be returned by the SDK. + */ + private DocumentResultCollection toPiiDocumentResultCollection( + final EntitiesResult entitiesResult) { + List recognizePiiEntitiesResults = new ArrayList<>(); + for (DocumentEntities documentEntities : entitiesResult.getDocuments()) { + recognizePiiEntitiesResults.add(new RecognizePiiEntitiesResult(documentEntities.getId(), + documentEntities.getStatistics() == null ? null + : toTextDocumentStatistics(documentEntities.getStatistics()), + null, documentEntities.getEntities().stream().map(entity -> + new NamedEntity(entity.getText(), entity.getType(), entity.getSubtype(), entity.getOffset(), + entity.getLength(), entity.getScore())).collect(Collectors.toList()))); + } + + for (DocumentError documentError : entitiesResult.getErrors()) { + final com.azure.ai.textanalytics.models.TextAnalyticsError error = + toTextAnalyticsError(documentError.getError()); + recognizePiiEntitiesResults.add(new RecognizePiiEntitiesResult(documentError.getId(), null, error, null)); + } + + return new DocumentResultCollection<>(recognizePiiEntitiesResults, + entitiesResult.getModelVersion(), entitiesResult.getStatistics() == null ? null + : toBatchStatistics(entitiesResult.getStatistics())); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java new file mode 100644 index 000000000000..34e03ee54dd3 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java @@ -0,0 +1,901 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; +import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsClientOptions; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Mono; + +import java.util.List; + +import static com.azure.core.util.FluxUtil.monoError; +import static com.azure.core.util.FluxUtil.withContext; + +/** + * This class provides an asynchronous client that contains all the operations that apply to Azure Text Analytics. + * Operations allowed by the client are language detection, sentiment analysis, and recognition entities, PII entities, + * and linked entities of a text input or list of test inputs. + * + *

Instantiating an asynchronous Text Analytics Client

+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.instantiation} + * + *

View {@link TextAnalyticsClientBuilder} for additional ways to construct the client.

+ * + * @see TextAnalyticsClientBuilder + */ +@ServiceClient(builder = TextAnalyticsClientBuilder.class, isAsync = true) +public final class TextAnalyticsAsyncClient { + private final ClientLogger logger = new ClientLogger(TextAnalyticsAsyncClient.class); + private final TextAnalyticsClientImpl service; + private final TextAnalyticsServiceVersion serviceVersion; + private final String defaultCountryHint; + private final String defaultLanguage; + final DetectLanguageAsyncClient detectLanguageAsyncClient; + final AnalyzeSentimentAsyncClient analyzeSentimentAsyncClient; + final ExtractKeyPhraseAsyncClient extractKeyPhraseAsyncClient; + final RecognizeEntityAsyncClient recognizeEntityAsyncClient; + final RecognizePiiEntityAsyncClient recognizePiiEntityAsyncClient; + final RecognizeLinkedEntityAsyncClient recognizeLinkedEntityAsyncClient; + + /** + * Create a {@code TextAnalyticsAsyncClient} that sends requests to the Text Analytics services's endpoint. Each + * service call goes through the {@link TextAnalyticsClientBuilder#pipeline http pipeline}. + * + * @param service The proxy service used to perform REST calls. + * @param serviceVersion The versions of Azure Text Analytics supported by this client library. + * @param clientOptions The {@link TextAnalyticsClientOptions client option} contains + * {@link TextAnalyticsClientOptions#getDefaultLanguage default language} and + * {@link TextAnalyticsClientOptions#getDefaultCountryHint()} default country hint} that could be used as default + * values for each request. + */ + TextAnalyticsAsyncClient(TextAnalyticsClientImpl service, TextAnalyticsServiceVersion serviceVersion, + TextAnalyticsClientOptions clientOptions) { + this.service = service; + this.serviceVersion = serviceVersion; + defaultCountryHint = clientOptions == null ? null : clientOptions.getDefaultCountryHint(); + defaultLanguage = clientOptions == null ? null : clientOptions.getDefaultLanguage(); + this.detectLanguageAsyncClient = new DetectLanguageAsyncClient(service); + this.analyzeSentimentAsyncClient = new AnalyzeSentimentAsyncClient(service); + this.extractKeyPhraseAsyncClient = new ExtractKeyPhraseAsyncClient(service); + this.recognizeEntityAsyncClient = new RecognizeEntityAsyncClient(service); + this.recognizePiiEntityAsyncClient = new RecognizePiiEntityAsyncClient(service); + this.recognizeLinkedEntityAsyncClient = new RecognizeLinkedEntityAsyncClient(service); + } + + /** + * Get default country hint code. + * + * @return the default country hint code + */ + public String getDefaultCountryHint() { + return defaultCountryHint; + } + + /** + * Get default language when the builder is setup. + * + * @return the default language + */ + public String getDefaultLanguage() { + return defaultLanguage; + } + + /** + * Gets the service version the client is using. + * + * @return the service version the client is using. + */ + public TextAnalyticsServiceVersion getServiceVersion() { + return serviceVersion; + } + + /** + * Returns the detected language and a numeric score between zero and one. Scores close to one indicate 100% + * certainty that the identified language is true. + * + * @param text The text to be analyzed. + * + * @return A {@link Mono} containing the {@link DetectLanguageResult detected language} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono detectLanguage(String text) { + try { + return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a {@link Response} containing the detected language and a numeric score between zero and one. Scores + * close to one indicate 100% certainty that the identified language is true. + * + * @param text The text to be analyzed. + * @param countryHint Accepts two letter country codes specified by ISO 3166-1 alpha-2. Defaults to "US" if not + * specified. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} has the + * {@link DetectLanguageResult detected language} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectLanguageWithResponse(String text, String countryHint) { + try { + return withContext(context -> + detectLanguageAsyncClient.detectLanguageWithResponse(text, countryHint, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns the detected language for a batch of input. + * + * @param textInputs The list of texts to be analyzed. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link DetectLanguageResult detected languages}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectLanguages(List textInputs) { + try { + return detectLanguagesWithResponse(textInputs, defaultCountryHint).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns the detected language for a batch of input with the provided country hint. + * + * @param textInputs The list of texts to be analyzed. + * @param countryHint A country hint for the entire batch. Accepts two letter country codes specified by ISO + * 3166-1 alpha-2. Defaults to "US" if not specified. + * + * @return A {@link Response} of {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link DetectLanguageResult detected languages}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> detectLanguagesWithResponse( + List textInputs, String countryHint) { + try { + return withContext(context -> detectLanguageAsyncClient.detectLanguagesWithResponse(textInputs, countryHint, + context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns the detected language for a batch of input. + * + * @param textInputs The list of {@link DetectLanguageInput inputs/documents} to be analyzed. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link DetectLanguageResult detected languages}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectBatchLanguages( + List textInputs) { + try { + return detectBatchLanguagesWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns the detected language for a batch of input. + * + * @param textInputs The list of {@link DetectLanguageInput inputs/documents} to be analyzed. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link DetectLanguageResult detected languages}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> detectBatchLanguagesWithResponse( + List textInputs, TextAnalyticsRequestOptions options) { + try { + return withContext( + context -> detectLanguageAsyncClient.detectBatchLanguagesWithResponse(textInputs, options, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + // Named Entity + /** + * Returns a list of general named entities in the provided text. For a list of supported entity types, check: + * . For a list of enabled languages, + * check: + * + * @param text the text to recognize entities for. + * + * @return A {@link Mono} containing the {@link RecognizeEntitiesResult named entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono recognizeEntities(String text) { + try { + return recognizeEntitiesWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of general named entities in the provided text. For a list of supported entity types, check: + * . For a list of enabled languages, + * check: + * + * @param text the text to recognize entities for. + * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as + * default. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} has the + * {@link RecognizeEntitiesResult named entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeEntitiesWithResponse(String text, String language) { + try { + return withContext(context -> + recognizeEntityAsyncClient.recognizeEntitiesWithResponse(text, language, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of general named entities for the provided list of texts. + * + * @param textInputs A list of texts to recognize entities for. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity} of the text. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeEntities(List textInputs) { + try { + return recognizeEntitiesWithResponse(textInputs, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of general named entities for the provided list of texts. + * + * @param textInputs A list of texts to recognize entities for. + * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as + * default. + * + * @return A {@link Response} of {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> recognizeEntitiesWithResponse( + List textInputs, String language) { + try { + return withContext(context -> recognizeEntityAsyncClient.recognizeEntitiesWithResponse(textInputs, language, + context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of general named entities for the provided list of text inputs. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize entities for. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeBatchEntities( + List textInputs) { + try { + return recognizeBatchEntitiesWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of general named entities for the provided list of text inputs. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize entities for. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link RecognizeEntitiesResult named entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> recognizeBatchEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options) { + try { + return withContext(context -> + recognizeEntityAsyncClient.recognizeBatchEntitiesWithResponse(textInputs, options, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + // PII Entity + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the text. For the list of + * supported entity types, check . See + * for the list of enabled languages. + * + * @param text the text to recognize PII entities for. + * + * @return A {@link Mono} containing the {@link RecognizeEntitiesResult PII entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono recognizePiiEntities(String text) { + try { + return recognizePiiEntitiesWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the text. For the list of + * supported entity types, check: . For a list of enabled languages, + * check: . + * + * @param text the text to recognize PII entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} has the + * {@link RecognizeEntitiesResult named entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizePiiEntitiesWithResponse(String text, String language) { + try { + return withContext(context -> recognizePiiEntityAsyncClient.recognizePiiEntitiesWithResponse(text, language, + context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the list of texts. For the list + * of supported entity types, check: . For a list of enabled languages, + * check: for the list of enabled languages. + * + * @param textInputs A list of text to recognize PII entities for. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity} of the text. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizePiiEntities(List textInputs) { + try { + return recognizePiiEntitiesWithResponse(textInputs, defaultLanguage) + .flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the list of texts. For the list + * of supported entity types, check . For a list of enabled languages, + * check: . + * + * @param textInputs A list of text to recognize PII entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Response} of {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> recognizePiiEntitiesWithResponse( + List textInputs, String language) { + try { + return withContext(context -> recognizePiiEntityAsyncClient.recognizePiiEntitiesWithResponse(textInputs, + language, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the batch of document inputs. For + * the list of supported entity types, check: + * For a list of enabled languages, check: . + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize PII entities for. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeBatchPiiEntities( + List textInputs) { + try { + return recognizeBatchPiiEntitiesWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the batch of document inputs. For + * the list of supported entity types,check: . For a list of enabled languages, + * check: . + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize PII entities for. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link RecognizeEntitiesResult named entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> recognizeBatchPiiEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options) { + try { + return withContext(context -> + recognizePiiEntityAsyncClient.recognizeBatchPiiEntitiesWithResponse(textInputs, options, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + // Linked Entity + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the provided text. See + * for supported languages in Text Analytics API. + * + * @param text the text to recognize linked entities for. + * + * @return A {@link Mono} containing the {@link RecognizeLinkedEntitiesResult linked entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono recognizeLinkedEntities(String text) { + try { + return recognizeLinkedEntitiesWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the provided text. See + * for supported languages in Text Analytics API. + * + * @param text the text to recognize linked entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} has the + * {@link RecognizeLinkedEntitiesResult named entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeLinkedEntitiesWithResponse(String text, + String language) { + try { + return withContext(context -> recognizeLinkedEntityAsyncClient.recognizeLinkedEntitiesWithResponse(text, + language, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of texts. See + * for supported languages in Text Analytics API. + * + * @param textInputs A list of text to recognize linked entities for. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeLinkedEntitiesResult linked entity} of the text. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeLinkedEntities( + List textInputs) { + try { + return recognizeLinkedEntitiesWithResponse(textInputs, defaultLanguage) + .flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of texts. See + * for supported languages in Text Analytics API. + * + * @param textInputs A list of text to recognize linked entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Response} of {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeLinkedEntitiesResult linked entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> recognizeLinkedEntitiesWithResponse( + List textInputs, String language) { + try { + return withContext(context -> + recognizeLinkedEntityAsyncClient.recognizeLinkedEntitiesWithResponse(textInputs, language, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of inputs. See + * for supported languages in Text Analytics API. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize linked entities for. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeLinkedEntitiesResult linked entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recognizeBatchLinkedEntities( + List textInputs) { + try { + return recognizeBatchLinkedEntitiesWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of inputs. See + * supported languages in Text Analytics API. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize linked entities for. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link RecognizeLinkedEntitiesResult linked entity}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> + recognizeBatchLinkedEntitiesWithResponse(List textInputs, + TextAnalyticsRequestOptions options) { + try { + return withContext(context -> recognizeLinkedEntityAsyncClient.recognizeBatchLinkedEntitiesWithResponse( + textInputs, options, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + // Key Phrases + /** + * Returns a list of strings denoting the key phrases in the input text. + * + * @param text the text to be analyzed. + * + * @return A {@link Mono} containing the {@link ExtractKeyPhraseResult key phrases} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono extractKeyPhrases(String text) { + try { + return extractKeyPhrasesWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of strings denoting the key phrases in the input text. See + * for the list of enabled languages. + * + * @param text the text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} has the + * {@link ExtractKeyPhraseResult key phrases} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> extractKeyPhrasesWithResponse(String text, String language) { + try { + return withContext(context -> extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(text, language, + context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * + * @param textInputs A list of text to be analyzed. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link ExtractKeyPhraseResult key phrases} of the text. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> extractKeyPhrases(List textInputs) { + try { + return extractKeyPhrasesWithResponse(textInputs, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of strings denoting the key phrases in the input text. See + * for the list of enabled languages. + * + * @param textInputs A list of text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Response} of {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link ExtractKeyPhraseResult key phrases}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> extractKeyPhrasesWithResponse( + List textInputs, String language) { + try { + return withContext(context -> extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(textInputs, + language, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link ExtractKeyPhraseResult key phrases}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> extractBatchKeyPhrases( + List textInputs) { + try { + return extractBatchKeyPhrasesWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a list of strings denoting the key phrases in the input text. See + * for the list of enabled languages. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link ExtractKeyPhraseResult key phrases}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> extractBatchKeyPhrasesWithResponse( + List textInputs, TextAnalyticsRequestOptions options) { + try { + return withContext(context -> + extractKeyPhraseAsyncClient.extractBatchKeyPhrasesWithResponse(textInputs, options, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + // Sentiment + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and + * Neutral) for the document and each sentence within i + * + * @param text the text to be analyzed. + * + * @return A {@link Mono} containing the {@link AnalyzeSentimentResult text sentiment} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeSentiment(String text) { + try { + return analyzeSentimentWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and + * Neutral) for the document and each sentence within i + * + * @param text the text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} has the + * {@link AnalyzeSentimentResult text sentiment} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeSentimentWithResponse(String text, String language) { + try { + return withContext(context -> + analyzeSentimentAsyncClient.analyzeSentimentWithResponse(text, language, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and + * Neutral) for the document and each sentence within it. + * + * @param textInputs A list of text to be analyzed. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link AnalyzeSentimentResult text sentiment} of the text. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeSentiment(List textInputs) { + try { + return analyzeSentimentWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and + * Neutral) for the document and each sentence within it. + * + * @param textInputs A list of text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * + * @return A {@link Response} of {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link AnalyzeSentimentResult text sentiment}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> analyzeSentimentWithResponse( + List textInputs, String language) { + try { + return withContext(context -> analyzeSentimentAsyncClient.analyzeSentimentWithResponse(textInputs, language, + context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and + * Neutral) for the document and each sentence within it. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * + * @return A {@link Mono} containing the {@link DocumentResultCollection batch} of the + * {@link AnalyzeSentimentResult text sentiment}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeBatchSentiment( + List textInputs) { + try { + return analyzeBatchSentimentWithResponse(textInputs, null).flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and + * Neutral) for the document and each sentence within it. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link AnalyzeSentimentResult text sentiment}. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> analyzeBatchSentimentWithResponse( + List textInputs, TextAnalyticsRequestOptions options) { + try { + return withContext(context -> analyzeSentimentAsyncClient.analyzeBatchSentimentWithResponse(textInputs, + options, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java new file mode 100644 index 000000000000..288d93f61489 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java @@ -0,0 +1,669 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; +import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +import java.util.List; + +/** + * This class provides a synchronous client that contains all the operations that apply to Azure Text Analytics. + * Operations allow by the client to detect language, recognize entities, recognize pii entities, + * recognize linked entities, and analyze sentiment for a text input or a list of text input. + * + *

Instantiating a synchronous Text Analytics Client

+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.instantiation} + * + *

View {@link TextAnalyticsClientBuilder this} for additional ways to construct the client.

+ * + * @see TextAnalyticsClientBuilder + */ +@ServiceClient(builder = TextAnalyticsClientBuilder.class) +public final class TextAnalyticsClient { + private final TextAnalyticsAsyncClient client; + + /** + * Create a {@code TextAnalyticsClient client} that sends requests to the Text Analytics service's endpoint. + * Each service call goes through the {@link TextAnalyticsClientBuilder#pipeline http pipeline}. + * + * @param client The {@link TextAnalyticsClient} that the client routes its request through. + */ + TextAnalyticsClient(TextAnalyticsAsyncClient client) { + this.client = client; + } + + /** + * Returns the detected language and a numeric score between zero and one. Scores close to one indicate 100% + * certainty that the identified language is true. + * + * @param text The text to be analyzed. + * @return the {@link DetectLanguageResult detected language} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DetectLanguageResult detectLanguage(String text) { + return detectLanguage(text, client.getDefaultCountryHint()); + } + + /** + * Returns the detected language and a numeric score between zero and one when the hint of country specified. + * Scores close to one indicate 100% certainty that the identified language is true. + * + * @param text The text to be analyzed. + * @param countryHint Accepts two letter country codes specified by ISO 3166-1 alpha-2. Defaults to "US" if not + * specified. + * + * @return the {@link DetectLanguageResult detected language} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DetectLanguageResult detectLanguage(String text, String countryHint) { + return detectLanguageWithResponse(text, countryHint, Context.NONE).getValue(); + } + + /** + * Returns a {@link Response} containing the detected language and a numeric score between zero and one. + * Scores close to one indicate 100% certainty that the identified language is true. + * + * @param text The text to be analyzed. + * @param countryHint Accepts two letter country codes specified by ISO 3166-1 alpha-2. Defaults to "US" if not + * specified. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DetectLanguageResult detected language} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectLanguageWithResponse(String text, String countryHint, Context context) { + return client.detectLanguageAsyncClient.detectLanguageWithResponse(text, countryHint, context).block(); + } + + /** + * Detects Language for a batch of input. + * + * @param textInputs The list of texts to be analyzed. + * + * @return A {@link DocumentResultCollection batch} containing the list of + * {@link DetectLanguageResult detected languages} with their numeric scores. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection detectLanguages(List textInputs) { + return detectLanguagesWithResponse(textInputs, client.getDefaultCountryHint(), Context.NONE).getValue(); + } + + /** + * Detects Language for a batch of input with the provided country hint. + * + * @param textInputs The list of texts to be analyzed. + * @param countryHint A country hint for the entire batch. Accepts two letter country codes specified by ISO 3166-1 + * alpha-2. Defaults to "US" if not specified. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of + * {@link DetectLanguageResult detected languages} with their numeric scores. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> detectLanguagesWithResponse( + List textInputs, String countryHint, Context context) { + return client.detectLanguageAsyncClient.detectLanguagesWithResponse(textInputs, countryHint, context).block(); + } + + /** + * Detects Language for a batch of input. + * + * @param textInputs The list of {@link DetectLanguageInput inputs/documents} to be analyzed. + * + * @return A {@link DocumentResultCollection batch} of {@link DetectLanguageResult detected languages}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection detectBatchLanguages(List textInputs) { + return detectBatchLanguagesWithResponse(textInputs, null, Context.NONE).getValue(); + } + + /** + * Detects Language for a batch of input. + * + * @param textInputs The list of {@link DetectLanguageInput inputs/documents} to be analyzed. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of + * {@link DetectLanguageResult detected languages}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> detectBatchLanguagesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + return client.detectLanguageAsyncClient.detectBatchLanguagesWithResponse(textInputs, options, context).block(); + } + + // Named Entity + /** + * Returns a list of general named entities in the provided text. + * For a list of supported entity types, check: + * + * @param text the text to recognize entities for. + * + * @return the {@link RecognizeEntitiesResult named entity} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecognizeEntitiesResult recognizeEntities(String text) { + return recognizeEntitiesWithResponse(text, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of general named entities in the provided text. + * For a list of supported entity types, check: + * For a list of enabled languages, check: + * + * @param text the text to recognize entities for. + * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link RecognizeEntitiesResult named entity} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recognizeEntitiesWithResponse( + String text, String language, Context context) { + return client.recognizeEntityAsyncClient.recognizeEntitiesWithResponse(text, language, context).block(); + } + + /** + * Returns a list of general named entities for the provided list of texts. + * + * @param textInputs A list of texts to recognize entities for. + * + * @return A {@link DocumentResultCollection batch} containing the list of + * {@link RecognizeEntitiesResult named entity} of the text. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection recognizeEntities(List textInputs) { + return recognizeEntitiesWithResponse(textInputs, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of general named entities for the provided list of texts. + * + * @param textInputs A list of texts to recognize entities for. + * @param language The 2 letter ISO 639-1 representation of language. If not set, uses "en" for English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeEntitiesResult named entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> recognizeEntitiesWithResponse( + List textInputs, String language, Context context) { + return client.recognizeEntityAsyncClient.recognizeEntitiesWithResponse(textInputs, language, context).block(); + } + + /** + * Returns a list of general named entities for the provided list of text inputs. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize entities for. + * + * @return A {@link DocumentResultCollection batch} of the {@link RecognizeEntitiesResult named entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection recognizeBatchEntities( + List textInputs) { + return recognizeBatchEntitiesWithResponse(textInputs, null, Context.NONE).getValue(); + } + + /** + * Returns a list of general named entities for the provided list of text inputs. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize entities for. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link RecognizeEntitiesResult named entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> recognizeBatchEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + return client.recognizeEntityAsyncClient.recognizeBatchEntitiesWithResponse(textInputs, options, + context).block(); + } + + // PII Entities + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the text. + * For the list of supported entity types, check pii. + * See for the list of enabled languages. + * + * @param text the text to recognize pii entities for. + * @return A {@link RecognizePiiEntitiesResult PII entity} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecognizePiiEntitiesResult recognizePiiEntities(String text) { + return recognizePiiEntitiesWithResponse(text, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the text. + * For the list of supported entity types, check https://aka.ms/tanerpii. + * See for the list of enabled languages. + * + * @param text the text to recognize pii entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} has the + * {@link RecognizePiiEntitiesResult named entity} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recognizePiiEntitiesWithResponse(String text, String language, + Context context) { + return client.recognizePiiEntityAsyncClient.recognizePiiEntitiesWithResponse(text, language, context).block(); + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the list of texts. + * For the list of supported entity types, check https://aka.ms/tanerpii. + * See for the list of enabled languages. + * + * @param textInputs A list of text to recognize pii entities for. + * + * @return A {@link DocumentResultCollection batch} of the {@link RecognizePiiEntitiesResult named entity} + * of the text. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection recognizePiiEntities(List textInputs) { + return recognizePiiEntitiesWithResponse(textInputs, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the list of texts. + * For the list of supported entity types, check . + * See for the list of enabled languages. + * * + * @param textInputs A list of text to recognize pii entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizePiiEntitiesResult named entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> recognizePiiEntitiesWithResponse( + List textInputs, String language, Context context) { + return client.recognizePiiEntityAsyncClient.recognizePiiEntitiesWithResponse(textInputs, language, + context).block(); + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the batch of document inputs. + * For the list of supported entity types, check . + * See for the list of enabled languages. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize pii entities for. + * + * @return A {@link DocumentResultCollection batch} of the {@link RecognizeEntitiesResult named entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection recognizeBatchPiiEntities( + List textInputs) { + return recognizeBatchPiiEntitiesWithResponse(textInputs, null, Context.NONE).getValue(); + } + + /** + * Returns a list of personal information entities ("SSN", "Bank Account", etc) in the batch of document inputs. + * For the list of supported entity types, check . + * See for the list of enabled languages. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize pii entities for. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link RecognizeEntitiesResult named entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> recognizeBatchPiiEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + return client.recognizePiiEntityAsyncClient.recognizeBatchPiiEntitiesWithResponse(textInputs, options, + context).block(); + } + + // Linked Entities + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the provided text. + * See for supported languages in Text Analytics API. + * + * @param text the text to recognize linked entities for. + * + * @return A {@link RecognizeLinkedEntitiesResult linked entity} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecognizeLinkedEntitiesResult recognizeLinkedEntities(String text) { + return recognizeLinkedEntitiesWithResponse(text, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the provided text. + * See for supported languages in Text Analytics API. + * + * @param text the text to recognize linked entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} has the + * {@link RecognizeLinkedEntitiesResult named entity} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recognizeLinkedEntitiesWithResponse(String text, String language, + Context context) { + return client.recognizeLinkedEntityAsyncClient.recognizeLinkedEntitiesWithResponse(text, language, + context).block(); + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of texts. + * See for supported languages in Text Analytics API. + * + * @param textInputs A list of text to recognize linked entities for. + * + * @return A {@link DocumentResultCollection batch} of the + * {@link RecognizeLinkedEntitiesResult linked entity} of the text. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection recognizeLinkedEntities(List textInputs) { + return recognizeLinkedEntitiesWithResponse(textInputs, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of texts. + * See for supported languages in Text Analytics API. + * + * @param textInputs A list of text to recognize linked entities for. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of the + * {@link RecognizeLinkedEntitiesResult linked entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> recognizeLinkedEntitiesWithResponse( + List textInputs, String language, Context context) { + return client.recognizeLinkedEntityAsyncClient.recognizeLinkedEntitiesWithResponse(textInputs, language, + context).block(); + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of inputs. + * See for supported languages in Text Analytics API. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize linked entities for. + * + * @return A {@link DocumentResultCollection batch} of the {@link RecognizeLinkedEntitiesResult linked entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection recognizeBatchLinkedEntities( + List textInputs) { + return recognizeBatchLinkedEntitiesWithResponse(textInputs, null, Context.NONE).getValue(); + } + + /** + * Returns a list of recognized entities with links to a well-known knowledge base for the list of inputs. + * See for supported languages in Text Analytics API. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to recognize linked entities for. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link RecognizeLinkedEntitiesResult linked entity}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> recognizeBatchLinkedEntitiesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + return client.recognizeLinkedEntityAsyncClient.recognizeBatchLinkedEntitiesWithResponse(textInputs, options, + context).block(); + } + + // Key Phrase + /** + * Returns a list of strings denoting the key phrases in the input text. + * + * @param text the text to be analyzed. + * + * @return A {@link ExtractKeyPhraseResult key phrases} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtractKeyPhraseResult extractKeyPhrases(String text) { + return extractKeyPhrasesWithResponse(text, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * See for the list of enabled languages. + * + * @param text the text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} has the + * {@link ExtractKeyPhraseResult key phrases} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response extractKeyPhrasesWithResponse(String text, String language, + Context context) { + return client.extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(text, language, context).block(); + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * + * @param textInputs A list of text to be analyzed. + * @return A {@link DocumentResultCollection batch} of the {@link ExtractKeyPhraseResult key phrases} of the text. + * + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection extractKeyPhrases(List textInputs) { + return extractKeyPhrasesWithResponse(textInputs, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * See for the list of enabled languages. + * + * @param textInputs A list of text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of the + * {@link ExtractKeyPhraseResult key phrases}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> extractKeyPhrasesWithResponse( + List textInputs, String language, Context context) { + return client.extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(textInputs, language, context).block(); + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * + * @return A {@link DocumentResultCollection batch} of the {@link ExtractKeyPhraseResult key phrases}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection extractBatchKeyPhrases(List textInputs) { + return extractBatchKeyPhrasesWithResponse(textInputs, null, Context.NONE).getValue(); + } + + /** + * Returns a list of strings denoting the key phrases in the input text. + * See for the list of enabled languages. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#getValue() value} contains the + * {@link DocumentResultCollection batch} of {@link ExtractKeyPhraseResult key phrases}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> extractBatchKeyPhrasesWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + return client.extractKeyPhraseAsyncClient.extractBatchKeyPhrasesWithResponse(textInputs, options, + context).block(); + } + + // Sentiment + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class + * (Positive, Negative, and Neutral) for the document and each sentence within i + * + * @param text the text to be analyzed. + * @return the {@link AnalyzeSentimentResult text sentiments} of the text. + * + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeSentimentResult analyzeSentiment(String text) { + return analyzeBatchSentimentWithResponse(text, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class + * (Positive, Negative, and Neutral) for the document and each sentence within i + * + * @param text the text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link AnalyzeSentimentResult text sentiments} of the text. + * @throws NullPointerException if {@code text} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeBatchSentimentWithResponse( + String text, String language, Context context) { + return client.analyzeSentimentAsyncClient.analyzeSentimentWithResponse(text, language, context).block(); + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class + * (Positive, Negative, and Neutral) for the document and each sentence within it. + * + * @param textInputs A list of text to be analyzed. + * + * @return A {@link DocumentResultCollection batch} containing the list of + * {@link AnalyzeSentimentResult text sentiments} with their numeric scores. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection analyzeSentiment(List textInputs) { + return analyzeSentimentWithResponse(textInputs, client.getDefaultLanguage(), Context.NONE).getValue(); + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class + * (Positive, Negative, and Neutral) for the document and each sentence within it. + * + * @param textInputs A list of text to be analyzed. + * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for + * English as default. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of + * {@link AnalyzeSentimentResult text sentiments} with their numeric scores. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> analyzeSentimentWithResponse( + List textInputs, String language, Context context) { + return client.analyzeSentimentAsyncClient.analyzeSentimentWithResponse(textInputs, language, context).block(); + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class + * (Positive, Negative, and Neutral) for the document and each sentence within it. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * + * @return A {@link DocumentResultCollection batch} of {@link AnalyzeSentimentResult text sentiments}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentResultCollection analyzeBatchSentiment(List textInputs) { + return analyzeBatchSentimentWithResponse(textInputs, null, Context.NONE).getValue(); + } + + /** + * Returns a sentiment prediction, as well as sentiment scores for each sentiment class + * (Positive, Negative, and Neutral) for the document and each sentence within it. + * + * @param textInputs A list of {@link TextDocumentInput inputs/documents} to be analyzed. + * @param options The {@link TextAnalyticsRequestOptions options} to configure the scoring model for documents + * and show statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} containing the {@link DocumentResultCollection batch} of + * {@link AnalyzeSentimentResult text sentiments}. + * @throws NullPointerException if {@code textInputs} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> analyzeBatchSentimentWithResponse( + List textInputs, TextAnalyticsRequestOptions options, Context context) { + return client.analyzeSentimentAsyncClient.analyzeBatchSentimentWithResponse(textInputs, options, + context).block(); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java new file mode 100644 index 000000000000..2c265fdb8a29 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; +import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImplBuilder; +import com.azure.ai.textanalytics.models.TextAnalyticsClientOptions; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; + +import java.net.MalformedURLException; +import java.net.URL; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * This class provides a fluent builder API to help instantiation of {@link TextAnalyticsClient TextAnalyticsClients} + * and {@link TextAnalyticsAsyncClient TextAnalyticsAsyncClients}, call {@link #buildClient()} buildClient} and + * {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of the desired client. + * + *

+ * The client needs the service endpoint of the Azure Text Analytics to access the resource service. + * {@link #subscriptionKey(String) subscriptionKey(String)} or + * {@link #credential(TokenCredential) credential(TokenCredential)} give the builder access credential. + *

+ * + *

+ * Another way to construct the client is using a {@link HttpPipeline}. The pipeline gives the client an + * authenticated way to communicate with the service. Set the pipeline with {@link #pipeline(HttpPipeline) this} and + * set the service endpoint with {@link #endpoint(String) this}. Using a + * pipeline requires additional setup but allows for finer control on how the {@link TextAnalyticsClient} and + * {@link TextAnalyticsAsyncClient} is built. + *

+ * + * @see TextAnalyticsAsyncClient + * @see TextAnalyticsClient + */ +@ServiceClientBuilder(serviceClients = {TextAnalyticsAsyncClient.class, TextAnalyticsClient.class}) +public final class TextAnalyticsClientBuilder { + private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; + private static final String CONTENT_TYPE_HEADER = "Content-Type"; + private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; + private static final String ACCEPT_HEADER = "Accept"; + private static final String TEXT_ANALYTICS_PROPERTIES = "azure-ai-textanalytics.properties"; + private static final String OCP_APIM_SUBSCRIPTION_KEY = "Ocp-Apim-Subscription-Key"; + private static final String NAME = "name"; + private static final String VERSION = "version"; + private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS); + private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default"; + + private final ClientLogger logger = new ClientLogger(TextAnalyticsClientBuilder.class); + private final List policies; + private final HttpHeaders headers; + private final String clientName; + private final String clientVersion; + + private String endpoint; + private String subscriptionKey; + private TokenCredential tokenCredential; + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private HttpPipeline httpPipeline; + private Configuration configuration; + private RetryPolicy retryPolicy; + private TextAnalyticsClientOptions clientOptions; + private TextAnalyticsServiceVersion version; + + /** + * The constructor with defaults. + */ + public TextAnalyticsClientBuilder() { + policies = new ArrayList<>(); + httpLogOptions = new HttpLogOptions(); + + Map properties = CoreUtils.getProperties(TEXT_ANALYTICS_PROPERTIES); + clientName = properties.getOrDefault(NAME, "UnknownName"); + clientVersion = properties.getOrDefault(VERSION, "UnknownVersion"); + + headers = new HttpHeaders() + .put(ECHO_REQUEST_ID_HEADER, "true") + .put(CONTENT_TYPE_HEADER, CONTENT_TYPE_HEADER_VALUE) + .put(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE); + } + + /** + * Creates a {@link TextAnalyticsClient} based on options set in the builder. Every time + * {@code buildClient()} is called a new instance of {@link TextAnalyticsClient} is created. + * + *

+ * If {@link #pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link #endpoint(String) endpoint} are used to create the {@link TextAnalyticsClient client}. All other builder + * settings are ignored + *

+ * + * @return A TextAnalyticsClient with the options set from the builder. + * @throws NullPointerException if {@link #endpoint(String) endpoint} or + * {@link #subscriptionKey(String) subscriptionKey} has not been set. + * @throws IllegalArgumentException if {@link #endpoint(String) endpoint} cannot be parsed into a valid URL. + */ + public TextAnalyticsClient buildClient() { + return new TextAnalyticsClient(buildAsyncClient()); + } + + + /** + * Creates a {@link TextAnalyticsAsyncClient} based on options set in the builder. Every time + * {@code buildAsyncClient()} is called a new instance of {@link TextAnalyticsAsyncClient} is created. + * + *

+ * If {@link #pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link #endpoint(String) endpoint} are used to create the {@link TextAnalyticsClient client}. All other builder + * settings are ignored. + *

+ * + * @return A TextAnalyticsAsyncClient with the options set from the builder. + * @throws NullPointerException if {@link #endpoint(String) endpoint} or + * {@link #subscriptionKey(String) subscriptionKey} has not been set. + * @throws IllegalArgumentException if {@link #endpoint(String) endpoint} cannot be parsed into a valid URL. + */ + public TextAnalyticsAsyncClient buildAsyncClient() { + // Global Env configuration store + final Configuration buildConfiguration = (configuration == null) + ? Configuration.getGlobalConfiguration().clone() : configuration; + // Service Version + final TextAnalyticsServiceVersion serviceVersion = + version != null ? version : TextAnalyticsServiceVersion.getLatest(); + + // Endpoint cannot be null, which is required in request authentication + Objects.requireNonNull(endpoint, "'Endpoint' is required and can not be null."); + + HttpPipeline pipeline = httpPipeline; + // Create a default Pipeline if it is not given + if (pipeline == null) { + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + + // Authentications + if (tokenCredential != null) { + // User token based policy + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE)); + } else if (subscriptionKey != null) { + headers.put(OCP_APIM_SUBSCRIPTION_KEY, subscriptionKey); + } else { + // Throw exception that credential and tokenCredential cannot be null + throw logger.logExceptionAsError( + new IllegalArgumentException("Missing credential information while building a client.")); + } + + policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, + buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersPolicy(headers)); + policies.add(new AddDatePolicy()); + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + + policies.add(new HttpLoggingPolicy(httpLogOptions)); + + pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + } + + final TextAnalyticsClientImpl textAnalyticsAPI = new TextAnalyticsClientImplBuilder() + .endpoint(endpoint) + .pipeline(pipeline) + .build(); + + return new TextAnalyticsAsyncClient(textAnalyticsAPI, serviceVersion, clientOptions); + } + + /** + * Set the default client option for one client. + * + * @param clientOptions TextAnalyticsClientOptions model that includes + * {@link TextAnalyticsClientOptions#getDefaultLanguage() default language} and + * {@link TextAnalyticsClientOptions#getDefaultCountryHint() default country hint} + * + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder clientOptions(TextAnalyticsClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Sets the service endpoint for the Azure Text Analytics instance. + * + * @param endpoint The URL of the Azure Text Analytics instance service requests to and receive responses from. + * @return The updated TextAnalyticsClientBuilder object. + * @throws NullPointerException if {@code endpoint} is null + * @throws IllegalArgumentException if {@code endpoint} cannot be parsed into a valid URL. + */ + public TextAnalyticsClientBuilder endpoint(String endpoint) { + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + + try { + new URL(endpoint); + } catch (MalformedURLException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'endpoint' must be a valid URL", ex)); + } + this.endpoint = endpoint; + return this; + } + + /** + * Sets the credential to use when authenticating HTTP requests for this TextAnalyticsClientBuilder. + * + * @param subscriptionKey subscription key + * + * @return The updated TextAnalyticsClientBuilder object. + * @throws NullPointerException If {@code subscriptionKey} is {@code null} + */ + public TextAnalyticsClientBuilder subscriptionKey(String subscriptionKey) { + Objects.requireNonNull(subscriptionKey, "'subscriptionKey' cannot be null."); + this.subscriptionKey = subscriptionKey; + return this; + } + + /** + * Sets the {@link TokenCredential} used to authenticate HTTP requests. + * + * @param tokenCredential TokenCredential used to authenticate HTTP requests. + * @return The updated TextAnalyticsClientBuilder object. + * @throws NullPointerException If {@code tokenCredential} is {@code null}. + */ + public TextAnalyticsClientBuilder credential(TokenCredential tokenCredential) { + Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); + this.tokenCredential = tokenCredential; + return this; + } + + /** + * Sets the logging configuration for HTTP requests and responses. + * + *

If logLevel is not provided, default value of {@link HttpLogDetailLevel#NONE} is set.

+ * + * @param logOptions The logging configuration to use when sending and receiving HTTP requests/responses. + * + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder httpLogOptions(HttpLogOptions logOptions) { + this.httpLogOptions = logOptions; + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after required policies. + * + * @param policy The retry policy for service requests. + * + * @return The updated TextAnalyticsClientBuilder object. + * @throws NullPointerException If {@code policy} is {@code null}. + */ + public TextAnalyticsClientBuilder addPolicy(HttpPipelinePolicy policy) { + Objects.requireNonNull(policy, "'policy' cannot be null."); + policies.add(policy); + return this; + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param client The HTTP client to use for requests. + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder httpClient(HttpClient client) { + if (this.httpClient != null && client == null) { + logger.info("HttpClient is being set to 'null' when it was previously configured."); + } + + this.httpClient = client; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + *

+ * If {@code pipeline} is set, all other settings are ignored, aside from + * {@link TextAnalyticsClientBuilder#endpoint(String) endpoint} to build {@link TextAnalyticsAsyncClient} or + * {@link TextAnalyticsClient}. + * + * @param httpPipeline The HTTP pipeline to use for sending service requests and receiving responses. + * + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder pipeline(HttpPipeline httpPipeline) { + if (this.httpPipeline != null && httpPipeline == null) { + logger.info("HttpPipeline is being set to 'null' when it was previously configured."); + } + + this.httpPipeline = httpPipeline; + return this; + } + + /** + * Sets the configuration store that is used during construction of the service client. + *

+ * The default configuration store is a clone of the {@link Configuration#getGlobalConfiguration() global + * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. + * + * @param configuration The configuration store used to + * + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Sets the {@link RetryPolicy} that is used when each request is sent. + *

+ * The default retry policy will be used if not provided {@link TextAnalyticsClientBuilder#buildAsyncClient()} + * to build {@link TextAnalyticsAsyncClient} or {@link TextAnalyticsClient}. + * + * @param retryPolicy user's retry policy applied to each request. + * + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Sets the {@link TextAnalyticsServiceVersion} that is used when making API requests. + *

+ * If a service version is not provided, the service version that will be used will be the latest known service + * version based on the version of the client library being used. If no service version is specified, updating to a + * newer version the client library will have the result of potentially moving to a newer service version. + * + * @param version {@link TextAnalyticsServiceVersion} of the service to be used when making requests. + * + * @return The updated TextAnalyticsClientBuilder object. + */ + public TextAnalyticsClientBuilder serviceVersion(TextAnalyticsServiceVersion version) { + this.version = version; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java new file mode 100644 index 000000000000..bb7b1a516842 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsServiceVersion.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.core.util.ServiceVersion; + +/** + * The versions of Azure Text Analytics supported by this client library. + */ +public enum TextAnalyticsServiceVersion implements ServiceVersion { + V3_0_preview_1("v3.0-preview.1"); + + private final String version; + + TextAnalyticsServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library + * + * @return the latest {@link TextAnalyticsServiceVersion} + */ + public static TextAnalyticsServiceVersion getLatest() { + return V3_0_preview_1; + } + +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/Transforms.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/Transforms.java new file mode 100644 index 000000000000..bb87131a9018 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/Transforms.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.models.DocumentStatistics; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageInput; +import com.azure.ai.textanalytics.implementation.models.RequestStatistics; +import com.azure.ai.textanalytics.implementation.models.TextAnalyticsError; +import com.azure.ai.textanalytics.models.ErrorCodeValue; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.models.TextDocumentStatistics; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.BiFunction; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +/** + * Helper class to convert service level models to SDK exposes models. + */ +class Transforms { + + /** + * Given a list of inputs will apply the indexing function to it and return the updated list. + * + * @param textInputs the inputs to apply the mapping function to. + * @param mappingFunction the function which applies the index to the incoming input value. + * @param the type of items being returned in the list. + * @return The list holding all the generic items combined. + */ + static List mapByIndex(List textInputs, BiFunction mappingFunction) { + return IntStream.range(0, textInputs.size()) + .mapToObj(index -> mappingFunction.apply(String.valueOf(index), textInputs.get(index))) + .collect(Collectors.toList()); + } + + /** + * Convert {@link DocumentStatistics} to {@link TextDocumentStatistics} + * + * @param statistics the {@link DocumentStatistics} provided by the service. + * @return the {@link TextDocumentStatistics} returned by the SDK. + */ + static TextDocumentStatistics toTextDocumentStatistics(DocumentStatistics statistics) { + return new TextDocumentStatistics(statistics.getCharactersCount(), statistics.getTransactionsCount()); + } + + /** + * Convert {@link RequestStatistics} to {@link TextDocumentBatchStatistics} + * + * @param statistics the {@link RequestStatistics} provided by the service. + * @return the {@link TextDocumentBatchStatistics} returned by the SDK. + */ + static TextDocumentBatchStatistics toBatchStatistics(RequestStatistics statistics) { + return new TextDocumentBatchStatistics(statistics.getDocumentsCount(), statistics.getValidDocumentsCount(), + statistics.getErroneousDocumentsCount(), statistics.getTransactionsCount()); + } + + /** + * Convert {@link TextAnalyticsError} to {@link com.azure.ai.textanalytics.models.TextAnalyticsError} + * + * @param textAnalyticsError the {@link TextAnalyticsError} returned by the service. + * @return the {@link com.azure.ai.textanalytics.models.TextAnalyticsError} returned by the SDK. + */ + static com.azure.ai.textanalytics.models.TextAnalyticsError toTextAnalyticsError( + TextAnalyticsError textAnalyticsError) { + return new com.azure.ai.textanalytics.models.TextAnalyticsError( + ErrorCodeValue.fromString(textAnalyticsError.getCode().toString()), textAnalyticsError.getMessage(), + textAnalyticsError.getTarget(), textAnalyticsError.getDetails() == null ? null + : setErrors(textAnalyticsError.getDetails())); + } + + /** + * Convert the incoming input {@link TextDocumentInput} to the service expected {@link MultiLanguageInput}. + * + * @param textInputs the user provided input in {@link TextDocumentInput} + * @return the service required input {@link MultiLanguageInput} + */ + static List toMultiLanguageInput(List textInputs) { + List multiLanguageInputs = new ArrayList<>(); + for (TextDocumentInput textDocumentInput : textInputs) { + multiLanguageInputs.add(new MultiLanguageInput().setId(textDocumentInput.getId()) + .setText(textDocumentInput.getText()).setLanguage(textDocumentInput.getLanguage())); + } + return multiLanguageInputs; + } + + /** + * Helper method to set error details on {@link TextAnalyticsError}. + * + * @param details about specific errors that led to this reported error. + * @return the {@link TextAnalyticsError} returned by the SDK. + */ + private static List setErrors( + List details) { + List detailsList = new ArrayList<>(); + for (TextAnalyticsError error : details) { + detailsList.add(new com.azure.ai.textanalytics.models.TextAnalyticsError( + ErrorCodeValue.fromString(error.getCode().toString()), + error.getMessage(), + error.getTarget(), error.getDetails() == null ? null : setErrors(error.getDetails()))); + } + return detailsList; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java new file mode 100644 index 000000000000..357d1f180e49 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.implementation.models.EntitiesResult; +import com.azure.ai.textanalytics.implementation.models.EntityLinkingResult; +import com.azure.ai.textanalytics.implementation.models.KeyPhraseResult; +import com.azure.ai.textanalytics.implementation.models.LanguageBatchInput; +import com.azure.ai.textanalytics.implementation.models.LanguageResult; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; +import com.azure.ai.textanalytics.implementation.models.SentimentResponse; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +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.exception.HttpResponseException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the TextAnalyticsClient type. + */ +public final class TextAnalyticsClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private TextAnalyticsClientService service; + + /** + * Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + */ + TextAnalyticsClientImpl setEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * The HTTP pipeline to send requests through. + */ + private HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * Initializes an instance of TextAnalyticsClient client. + */ + public TextAnalyticsClientImpl() { + new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()).build(); + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + */ + public TextAnalyticsClientImpl(HttpPipeline httpPipeline) { + this.httpPipeline = httpPipeline; + this.service = RestProxy.create(TextAnalyticsClientService.class, this.httpPipeline); + } + + /** + * The interface defining all the services for TextAnalyticsClient to be + * used by the proxy service to perform REST calls. + */ + @Host("{Endpoint}/text/analytics/v3.0-preview.1") + @ServiceInterface(name = "TextAnalyticsClient") + private interface TextAnalyticsClientService { + @Post("entities/recognition/general") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> entitiesRecognitionGeneral(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json; charset=utf-8") MultiLanguageBatchInput input, Context context); + + @Post("entities/recognition/pii") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> entitiesRecognitionPii(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json; charset=utf-8") MultiLanguageBatchInput input, Context context); + + @Post("entities/linking") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> entitiesLinking(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json; charset=utf-8") MultiLanguageBatchInput input, Context context); + + @Post("keyPhrases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> keyPhrases(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json; charset=utf-8") MultiLanguageBatchInput input, Context context); + + @Post("languages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> languages(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json; charset=utf-8") LanguageBatchInput input, Context context); + + @Post("sentiment") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sentiment(@HostParam("Endpoint") String endpoint, @QueryParam("model-version") String modelVersion, @QueryParam("showStats") Boolean showStats, @BodyParam("application/json; charset=utf-8") MultiLanguageBatchInput input, Context context); + } + + /** + * Named Entity Recognition + * The API returns a list of general named entities in a given document. For the list of supported entity types, check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesRecognitionGeneralWithRestResponseAsync(MultiLanguageBatchInput input, Context context) { + final String modelVersion = null; + final Boolean showStats = null; + return service.entitiesRecognitionGeneral(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Named Entity Recognition + * The API returns a list of general named entities in a given document. For the list of supported entity types, check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesRecognitionGeneralWithRestResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + return service.entitiesRecognitionGeneral(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Entities containing personal information + * The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in the document. For the list of supported entity types, check <a href="https://aka.ms/tanerpii">Supported Entity Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesRecognitionPiiWithRestResponseAsync(MultiLanguageBatchInput input, Context context) { + final String modelVersion = null; + final Boolean showStats = null; + return service.entitiesRecognitionPii(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Entities containing personal information + * The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in the document. For the list of supported entity types, check <a href="https://aka.ms/tanerpii">Supported Entity Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesRecognitionPiiWithRestResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + return service.entitiesRecognitionPii(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Linked entities from a well-known knowledge base + * The API returns a list of recognized entities with links to a well-known knowledge base. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesLinkingWithRestResponseAsync(MultiLanguageBatchInput input, Context context) { + final String modelVersion = null; + final Boolean showStats = null; + return service.entitiesLinking(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Linked entities from a well-known knowledge base + * The API returns a list of recognized entities with links to a well-known knowledge base. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> entitiesLinkingWithRestResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + return service.entitiesLinking(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Key Phrases + * The API returns a list of strings denoting the key phrases in the input text. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. Documents can now contain a language field to indicate the text language. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> keyPhrasesWithRestResponseAsync(MultiLanguageBatchInput input, Context context) { + final String modelVersion = null; + final Boolean showStats = null; + return service.keyPhrases(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Key Phrases + * The API returns a list of strings denoting the key phrases in the input text. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. Documents can now contain a language field to indicate the text language. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> keyPhrasesWithRestResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + return service.keyPhrases(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Detect Language + * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languagesWithRestResponseAsync(LanguageBatchInput input, Context context) { + final String modelVersion = null; + final Boolean showStats = null; + return service.languages(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Detect Language + * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languagesWithRestResponseAsync(LanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + return service.languages(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Sentiment + * The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sentimentWithRestResponseAsync(MultiLanguageBatchInput input, Context context) { + final String modelVersion = null; + final Boolean showStats = null; + return service.sentiment(this.getEndpoint(), modelVersion, showStats, input, context); + } + + /** + * Sentiment + * The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it. See the <a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain input and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sentimentWithRestResponseAsync(MultiLanguageBatchInput input, String modelVersion, Boolean showStats, Context context) { + return service.sentiment(this.getEndpoint(), modelVersion, showStats, input, context); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java new file mode 100644 index 000000000000..dc59d2fc68aa --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImplBuilder.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.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.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; + +/** + * A builder for creating a new instance of the TextAnalyticsClient type. + */ +@ServiceClientBuilder(serviceClients = TextAnalyticsClientImpl.class) +public final class TextAnalyticsClientImplBuilder { + /* + * Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + */ + private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the TextAnalyticsClientImplBuilder. + */ + public TextAnalyticsClientImplBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + 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 TextAnalyticsClientImplBuilder. + */ + public TextAnalyticsClientImplBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /** + * Builds an instance of TextAnalyticsClientImpl with the provided parameters. + * + * @return an instance of TextAnalyticsClientImpl. + */ + public TextAnalyticsClientImpl build() { + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()).build(); + } + TextAnalyticsClientImpl client = new TextAnalyticsClientImpl(pipeline); + if (this.endpoint != null) { + client.setEndpoint(this.endpoint); + } + return client; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java new file mode 100644 index 000000000000..5eec388b2d15 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The DetectedLanguage model. + */ +@Fluent +public final class DetectedLanguage { + /* + * Long name of a detected language (e.g. English, French). + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * A two letter representation of the detected language according to the + * ISO 639-1 standard (e.g. en, fr). + */ + @JsonProperty(value = "iso6391Name", required = true) + private String iso6391Name; + + /* + * A confidence score between 0 and 1. Scores close to 1 indicate 100% + * certainty that the identified language is true. + */ + @JsonProperty(value = "score", required = true) + private double score; + + /** + * Get the name property: Long name of a detected language (e.g. English, + * French). + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: Long name of a detected language (e.g. English, + * French). + * + * @param name the name value to set. + * @return the DetectedLanguage object itself. + */ + public DetectedLanguage setName(String name) { + this.name = name; + return this; + } + + /** + * Get the iso6391Name property: A two letter representation of the + * detected language according to the ISO 639-1 standard (e.g. en, fr). + * + * @return the iso6391Name value. + */ + public String getIso6391Name() { + return this.iso6391Name; + } + + /** + * Set the iso6391Name property: A two letter representation of the + * detected language according to the ISO 639-1 standard (e.g. en, fr). + * + * @param iso6391Name the iso6391Name value to set. + * @return the DetectedLanguage object itself. + */ + public DetectedLanguage setIso6391Name(String iso6391Name) { + this.iso6391Name = iso6391Name; + return this; + } + + /** + * Get the score property: A confidence score between 0 and 1. Scores close + * to 1 indicate 100% certainty that the identified language is true. + * + * @return the score value. + */ + public double getScore() { + return this.score; + } + + /** + * Set the score property: A confidence score between 0 and 1. Scores close + * to 1 indicate 100% certainty that the identified language is true. + * + * @param score the score value to set. + * @return the DetectedLanguage object itself. + */ + public DetectedLanguage setScore(double score) { + this.score = score; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.java new file mode 100644 index 000000000000..dffd817a1919 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentEntities.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.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The DocumentEntities model. + */ +@Fluent +public final class DocumentEntities { + /* + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Recognized entities in the document. + */ + @JsonProperty(value = "entities", required = true) + private List entities; + + /* + * if showStats=true was specified in the request this field will contain + * information about the document payload. + */ + @JsonProperty(value = "statistics") + private DocumentStatistics statistics; + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the DocumentEntities object itself. + */ + public DocumentEntities setId(String id) { + this.id = id; + return this; + } + + /** + * Get the entities property: Recognized entities in the document. + * + * @return the entities value. + */ + public List getEntities() { + return this.entities; + } + + /** + * Set the entities property: Recognized entities in the document. + * + * @param entities the entities value to set. + * @return the DocumentEntities object itself. + */ + public DocumentEntities setEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @return the statistics value. + */ + public DocumentStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @param statistics the statistics value to set. + * @return the DocumentEntities object itself. + */ + public DocumentEntities setStatistics(DocumentStatistics statistics) { + this.statistics = statistics; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java new file mode 100644 index 000000000000..7813edbe60a9 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The DocumentError model. + */ +@Fluent +public final class DocumentError { + /* + * Document Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Document Error. + */ + @JsonProperty(value = "error", required = true) + private TextAnalyticsError error; + + /** + * Get the id property: Document Id. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Document Id. + * + * @param id the id value to set. + * @return the DocumentError object itself. + */ + public DocumentError setId(String id) { + this.id = id; + return this; + } + + /** + * Get the error property: Document Error. + * + * @return the error value. + */ + public TextAnalyticsError getError() { + return this.error; + } + + /** + * Set the error property: Document Error. + * + * @param error the error value to set. + * @return the DocumentError object itself. + */ + public DocumentError setError(TextAnalyticsError error) { + this.error = error; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java new file mode 100644 index 000000000000..e7def8e817f2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentKeyPhrases.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The DocumentKeyPhrases model. + */ +@Fluent +public final class DocumentKeyPhrases { + /* + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * A list of representative words or phrases. The number of key phrases + * returned is proportional to the number of words in the input document. + */ + @JsonProperty(value = "keyPhrases", required = true) + private List keyPhrases; + + /* + * if showStats=true was specified in the request this field will contain + * information about the document payload. + */ + @JsonProperty(value = "statistics") + private DocumentStatistics statistics; + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the DocumentKeyPhrases object itself. + */ + public DocumentKeyPhrases setId(String id) { + this.id = id; + return this; + } + + /** + * Get the keyPhrases property: A list of representative words or phrases. + * The number of key phrases returned is proportional to the number of + * words in the input document. + * + * @return the keyPhrases value. + */ + public List getKeyPhrases() { + return this.keyPhrases; + } + + /** + * Set the keyPhrases property: A list of representative words or phrases. + * The number of key phrases returned is proportional to the number of + * words in the input document. + * + * @param keyPhrases the keyPhrases value to set. + * @return the DocumentKeyPhrases object itself. + */ + public DocumentKeyPhrases setKeyPhrases(List keyPhrases) { + this.keyPhrases = keyPhrases; + return this; + } + + /** + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @return the statistics value. + */ + public DocumentStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @param statistics the statistics value to set. + * @return the DocumentKeyPhrases object itself. + */ + public DocumentKeyPhrases setStatistics(DocumentStatistics statistics) { + this.statistics = statistics; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.java new file mode 100644 index 000000000000..588292564911 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLanguage.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.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The DocumentLanguage model. + */ +@Fluent +public final class DocumentLanguage { + /* + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * A list of extracted languages. + */ + @JsonProperty(value = "detectedLanguages", required = true) + private List detectedLanguages; + + /* + * if showStats=true was specified in the request this field will contain + * information about the document payload. + */ + @JsonProperty(value = "statistics") + private DocumentStatistics statistics; + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the DocumentLanguage object itself. + */ + public DocumentLanguage setId(String id) { + this.id = id; + return this; + } + + /** + * Get the detectedLanguages property: A list of extracted languages. + * + * @return the detectedLanguages value. + */ + public List getDetectedLanguages() { + return this.detectedLanguages; + } + + /** + * Set the detectedLanguages property: A list of extracted languages. + * + * @param detectedLanguages the detectedLanguages value to set. + * @return the DocumentLanguage object itself. + */ + public DocumentLanguage setDetectedLanguages(List detectedLanguages) { + this.detectedLanguages = detectedLanguages; + return this; + } + + /** + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @return the statistics value. + */ + public DocumentStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @param statistics the statistics value to set. + * @return the DocumentLanguage object itself. + */ + public DocumentLanguage setStatistics(DocumentStatistics statistics) { + this.statistics = statistics; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java new file mode 100644 index 000000000000..f3345e8d3cc9 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentLinkedEntities.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The DocumentLinkedEntities model. + */ +@Fluent +public final class DocumentLinkedEntities { + /* + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Recognized well-known entities in the document. + */ + @JsonProperty(value = "entities", required = true) + private List entities; + + /* + * if showStats=true was specified in the request this field will contain + * information about the document payload. + */ + @JsonProperty(value = "statistics") + private DocumentStatistics statistics; + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the DocumentLinkedEntities object itself. + */ + public DocumentLinkedEntities setId(String id) { + this.id = id; + return this; + } + + /** + * Get the entities property: Recognized well-known entities in the + * document. + * + * @return the entities value. + */ + public List getEntities() { + return this.entities; + } + + /** + * Set the entities property: Recognized well-known entities in the + * document. + * + * @param entities the entities value to set. + * @return the DocumentLinkedEntities object itself. + */ + public DocumentLinkedEntities setEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * Get the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @return the statistics value. + */ + public DocumentStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: if showStats=true was specified in the + * request this field will contain information about the document payload. + * + * @param statistics the statistics value to set. + * @return the DocumentLinkedEntities object itself. + */ + public DocumentLinkedEntities setStatistics(DocumentStatistics statistics) { + this.statistics = statistics; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java new file mode 100644 index 000000000000..a02c8fabadc3 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentiment.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The DocumentSentiment model. + */ +@Fluent +public final class DocumentSentiment { + /* + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Predicted sentiment for document (Negative, Neutral, Positive, or + * Mixed). Possible values include: 'positive', 'neutral', 'negative', + * 'mixed' + */ + @JsonProperty(value = "sentiment", required = true) + private DocumentSentimentValue sentiment; + + /* + * The statistics property. + */ + @JsonProperty(value = "statistics") + private DocumentStatistics statistics; + + /* + * Document level sentiment confidence scores between 0 and 1 for each + * sentiment class. + */ + @JsonProperty(value = "documentScores", required = true) + private SentimentConfidenceScorePerLabel documentScores; + + /* + * Sentence level sentiment analysis. + */ + @JsonProperty(value = "sentences", required = true) + private List sentences; + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the DocumentSentiment object itself. + */ + public DocumentSentiment setId(String id) { + this.id = id; + return this; + } + + /** + * Get the sentiment property: Predicted sentiment for document (Negative, + * Neutral, Positive, or Mixed). Possible values include: 'positive', + * 'neutral', 'negative', 'mixed'. + * + * @return the sentiment value. + */ + public DocumentSentimentValue getSentiment() { + return this.sentiment; + } + + /** + * Set the sentiment property: Predicted sentiment for document (Negative, + * Neutral, Positive, or Mixed). Possible values include: 'positive', + * 'neutral', 'negative', 'mixed'. + * + * @param sentiment the sentiment value to set. + * @return the DocumentSentiment object itself. + */ + public DocumentSentiment setSentiment(DocumentSentimentValue sentiment) { + this.sentiment = sentiment; + return this; + } + + /** + * Get the statistics property: The statistics property. + * + * @return the statistics value. + */ + public DocumentStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: The statistics property. + * + * @param statistics the statistics value to set. + * @return the DocumentSentiment object itself. + */ + public DocumentSentiment setStatistics(DocumentStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get the documentScores property: Document level sentiment confidence + * scores between 0 and 1 for each sentiment class. + * + * @return the documentScores value. + */ + public SentimentConfidenceScorePerLabel getDocumentScores() { + return this.documentScores; + } + + /** + * Set the documentScores property: Document level sentiment confidence + * scores between 0 and 1 for each sentiment class. + * + * @param documentScores the documentScores value to set. + * @return the DocumentSentiment object itself. + */ + public DocumentSentiment setDocumentScores(SentimentConfidenceScorePerLabel documentScores) { + this.documentScores = documentScores; + return this; + } + + /** + * Get the sentences property: Sentence level sentiment analysis. + * + * @return the sentences value. + */ + public List getSentences() { + return this.sentences; + } + + /** + * Set the sentences property: Sentence level sentiment analysis. + * + * @param sentences the sentences value to set. + * @return the DocumentSentiment object itself. + */ + public DocumentSentiment setSentences(List sentences) { + this.sentences = sentences; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java new file mode 100644 index 000000000000..96af38b7ab1a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.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.ai.textanalytics.implementation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DocumentSentimentValue. + */ +public enum DocumentSentimentValue { + /** + * Enum value positive. + */ + POSITIVE("positive"), + + /** + * Enum value neutral. + */ + NEUTRAL("neutral"), + + /** + * Enum value negative. + */ + NEGATIVE("negative"), + + /** + * Enum value mixed. + */ + MIXED("mixed"); + + /** + * The actual serialized value for a DocumentSentimentValue instance. + */ + private final String value; + + DocumentSentimentValue(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DocumentSentimentValue instance. + * + * @param value the serialized value to parse. + * @return the parsed DocumentSentimentValue object, or null if unable to parse. + */ + @JsonCreator + public static DocumentSentimentValue fromString(String value) { + DocumentSentimentValue[] items = DocumentSentimentValue.values(); + for (DocumentSentimentValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java new file mode 100644 index 000000000000..6dac964785f1 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * if showStats=true was specified in the request this field will contain + * information about the document payload. + */ +@Fluent +public final class DocumentStatistics { + /* + * Number of text elements recognized in the document. + */ + @JsonProperty(value = "charactersCount", required = true) + private int charactersCount; + + /* + * Number of transactions for the document. + */ + @JsonProperty(value = "transactionsCount", required = true) + private int transactionsCount; + + /** + * Get the charactersCount property: Number of text elements recognized in + * the document. + * + * @return the charactersCount value. + */ + public int getCharactersCount() { + return this.charactersCount; + } + + /** + * Set the charactersCount property: Number of text elements recognized in + * the document. + * + * @param charactersCount the charactersCount value to set. + * @return the DocumentStatistics object itself. + */ + public DocumentStatistics setCharactersCount(int charactersCount) { + this.charactersCount = charactersCount; + return this; + } + + /** + * Get the transactionsCount property: Number of transactions for the + * document. + * + * @return the transactionsCount value. + */ + public int getTransactionsCount() { + return this.transactionsCount; + } + + /** + * Set the transactionsCount property: Number of transactions for the + * document. + * + * @param transactionsCount the transactionsCount value to set. + * @return the DocumentStatistics object itself. + */ + public DocumentStatistics setTransactionsCount(int transactionsCount) { + this.transactionsCount = transactionsCount; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java new file mode 100644 index 000000000000..e80597e11c8e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The EntitiesResult model. + */ +@Fluent +public final class EntitiesResult { + /* + * Response by document + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /* + * Errors by document id. + */ + @JsonProperty(value = "errors", required = true) + private List errors; + + /* + * The statistics property. + */ + @JsonProperty(value = "statistics") + private RequestStatistics statistics; + + /* + * This field indicates which model is used for scoring. + */ + @JsonProperty(value = "modelVersion", required = true) + private String modelVersion; + + /** + * Get the documents property: Response by document. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: Response by document. + * + * @param documents the documents value to set. + * @return the EntitiesResult object itself. + */ + public EntitiesResult setDocuments(List documents) { + this.documents = documents; + return this; + } + + /** + * Get the errors property: Errors by document id. + * + * @return the errors value. + */ + public List getErrors() { + return this.errors; + } + + /** + * Set the errors property: Errors by document id. + * + * @param errors the errors value to set. + * @return the EntitiesResult object itself. + */ + public EntitiesResult setErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the statistics property: The statistics property. + * + * @return the statistics value. + */ + public RequestStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: The statistics property. + * + * @param statistics the statistics value to set. + * @return the EntitiesResult object itself. + */ + public EntitiesResult setStatistics(RequestStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * + * @param modelVersion the modelVersion value to set. + * @return the EntitiesResult object itself. + */ + public EntitiesResult setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java new file mode 100644 index 000000000000..1c781826bd9b --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Entity model. + */ +@Fluent +public final class Entity { + /* + * Entity text as appears in the request. + */ + @JsonProperty(value = "text", required = true) + private String text; + + /* + * Entity type, such as Person/Location/Org/SSN etc + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * Entity sub type, such as Age/Year/TimeRange etc + */ + @JsonProperty(value = "subtype") + private String subtype; + + /* + * Start position (in Unicode characters) for the entity text. + */ + @JsonProperty(value = "offset", required = true) + private int offset; + + /* + * Length (in Unicode characters) for the entity text. + */ + @JsonProperty(value = "length", required = true) + private int length; + + /* + * Confidence score between 0 and 1 of the extracted entity. + */ + @JsonProperty(value = "score", required = true) + private double score; + + /** + * Get the text property: Entity text as appears in the request. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Set the text property: Entity text as appears in the request. + * + * @param text the text value to set. + * @return the Entity object itself. + */ + public Entity setText(String text) { + this.text = text; + return this; + } + + /** + * Get the type property: Entity type, such as Person/Location/Org/SSN etc. + * + * @return the type value. + */ + public String getType() { + return this.type; + } + + /** + * Set the type property: Entity type, such as Person/Location/Org/SSN etc. + * + * @param type the type value to set. + * @return the Entity object itself. + */ + public Entity setType(String type) { + this.type = type; + return this; + } + + /** + * Get the subtype property: Entity sub type, such as Age/Year/TimeRange + * etc. + * + * @return the subtype value. + */ + public String getSubtype() { + return this.subtype; + } + + /** + * Set the subtype property: Entity sub type, such as Age/Year/TimeRange + * etc. + * + * @param subtype the subtype value to set. + * @return the Entity object itself. + */ + public Entity setSubtype(String subtype) { + this.subtype = subtype; + return this; + } + + /** + * Get the offset property: Start position (in Unicode characters) for the + * entity text. + * + * @return the offset value. + */ + public int getOffset() { + return this.offset; + } + + /** + * Set the offset property: Start position (in Unicode characters) for the + * entity text. + * + * @param offset the offset value to set. + * @return the Entity object itself. + */ + public Entity setOffset(int offset) { + this.offset = offset; + return this; + } + + /** + * Get the length property: Length (in Unicode characters) for the entity + * text. + * + * @return the length value. + */ + public int getLength() { + return this.length; + } + + /** + * Set the length property: Length (in Unicode characters) for the entity + * text. + * + * @param length the length value to set. + * @return the Entity object itself. + */ + public Entity setLength(int length) { + this.length = length; + return this; + } + + /** + * Get the score property: Confidence score between 0 and 1 of the + * extracted entity. + * + * @return the score value. + */ + public double getScore() { + return this.score; + } + + /** + * Set the score property: Confidence score between 0 and 1 of the + * extracted entity. + * + * @param score the score value to set. + * @return the Entity object itself. + */ + public Entity setScore(double score) { + this.score = score; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java new file mode 100644 index 000000000000..8c0d733e4b67 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The EntityLinkingResult model. + */ +@Fluent +public final class EntityLinkingResult { + /* + * Response by document + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /* + * Errors by document id. + */ + @JsonProperty(value = "errors", required = true) + private List errors; + + /* + * The statistics property. + */ + @JsonProperty(value = "statistics") + private RequestStatistics statistics; + + /* + * This field indicates which model is used for scoring. + */ + @JsonProperty(value = "modelVersion", required = true) + private String modelVersion; + + /** + * Get the documents property: Response by document. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: Response by document. + * + * @param documents the documents value to set. + * @return the EntityLinkingResult object itself. + */ + public EntityLinkingResult setDocuments(List documents) { + this.documents = documents; + return this; + } + + /** + * Get the errors property: Errors by document id. + * + * @return the errors value. + */ + public List getErrors() { + return this.errors; + } + + /** + * Set the errors property: Errors by document id. + * + * @param errors the errors value to set. + * @return the EntityLinkingResult object itself. + */ + public EntityLinkingResult setErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the statistics property: The statistics property. + * + * @return the statistics value. + */ + public RequestStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: The statistics property. + * + * @param statistics the statistics value to set. + * @return the EntityLinkingResult object itself. + */ + public EntityLinkingResult setStatistics(RequestStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * + * @param modelVersion the modelVersion value to set. + * @return the EntityLinkingResult object itself. + */ + public EntityLinkingResult setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.java new file mode 100644 index 000000000000..2a00a654b655 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCodeValue.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.ai.textanalytics.implementation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ErrorCodeValue. + */ +public enum ErrorCodeValue { + /** + * Enum value invalidRequest. + */ + INVALID_REQUEST("invalidRequest"), + + /** + * Enum value invalidArgument. + */ + INVALID_ARGUMENT("invalidArgument"), + + /** + * Enum value internalServerError. + */ + INTERNAL_SERVER_ERROR("internalServerError"), + + /** + * Enum value serviceUnavailable. + */ + SERVICE_UNAVAILABLE("serviceUnavailable"); + + /** + * The actual serialized value for a ErrorCodeValue instance. + */ + private final String value; + + ErrorCodeValue(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ErrorCodeValue instance. + * + * @param value the serialized value to parse. + * @return the parsed ErrorCodeValue object, or null if unable to parse. + */ + @JsonCreator + public static ErrorCodeValue fromString(String value) { + ErrorCodeValue[] items = ErrorCodeValue.values(); + for (ErrorCodeValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorException.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorException.java new file mode 100644 index 000000000000..a163a5638869 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorException.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with Error information. + */ +public final class ErrorException extends HttpResponseException { + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorException(String message, HttpResponse response, Error value) { + super(message, response, value); + } + + @Override + public Error getValue() { + return (Error) super.getValue(); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java new file mode 100644 index 000000000000..ea1339baed9e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerError.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The InnerError model. + */ +@Fluent +public final class InnerError { + /* + * Error code. Possible values include: 'invalidParameterValue', + * 'invalidRequestBodyFormat', 'emptyRequest', 'missingInputRecords', + * 'invalidDocument', 'modelVersionIncorrect', 'invalidDocumentBatch', + * 'unsupportedLanguageCode', 'invalidCountryHint' + */ + @JsonProperty(value = "code", required = true) + private InnerErrorCodeValue code; + + /* + * Error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /* + * Error details. + */ + @JsonProperty(value = "details") + private Map details; + + /* + * Error target. + */ + @JsonProperty(value = "target") + private String target; + + /* + * Inner error contains more specific information. + */ + @JsonProperty(value = "innerError") + private InnerError innerError; + + /** + * Get the code property: Error code. Possible values include: + * 'invalidParameterValue', 'invalidRequestBodyFormat', 'emptyRequest', + * 'missingInputRecords', 'invalidDocument', 'modelVersionIncorrect', + * 'invalidDocumentBatch', 'unsupportedLanguageCode', 'invalidCountryHint'. + * + * @return the code value. + */ + public InnerErrorCodeValue getCode() { + return this.code; + } + + /** + * Set the code property: Error code. Possible values include: + * 'invalidParameterValue', 'invalidRequestBodyFormat', 'emptyRequest', + * 'missingInputRecords', 'invalidDocument', 'modelVersionIncorrect', + * 'invalidDocumentBatch', 'unsupportedLanguageCode', 'invalidCountryHint'. + * + * @param code the code value to set. + * @return the InnerError object itself. + */ + public InnerError setCode(InnerErrorCodeValue code) { + this.code = code; + return this; + } + + /** + * Get the message property: Error message. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Set the message property: Error message. + * + * @param message the message value to set. + * @return the InnerError object itself. + */ + public InnerError setMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details property: Error details. + * + * @return the details value. + */ + public Map getDetails() { + return this.details; + } + + /** + * Set the details property: Error details. + * + * @param details the details value to set. + * @return the InnerError object itself. + */ + public InnerError setDetails(Map details) { + this.details = details; + return this; + } + + /** + * Get the target property: Error target. + * + * @return the target value. + */ + public String getTarget() { + return this.target; + } + + /** + * Set the target property: Error target. + * + * @param target the target value to set. + * @return the InnerError object itself. + */ + public InnerError setTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the innerError property: Inner error contains more specific + * information. + * + * @return the innerError value. + */ + public InnerError getInnerError() { + return this.innerError; + } + + /** + * Set the innerError property: Inner error contains more specific + * information. + * + * @param innerError the innerError value to set. + * @return the InnerError object itself. + */ + public InnerError setInnerError(InnerError innerError) { + this.innerError = innerError; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java new file mode 100644 index 000000000000..caec203e43b7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCodeValue.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for InnerErrorCodeValue. + */ +public enum InnerErrorCodeValue { + /** + * Enum value invalidParameterValue. + */ + INVALID_PARAMETER_VALUE("invalidParameterValue"), + + /** + * Enum value invalidRequestBodyFormat. + */ + INVALID_REQUEST_BODY_FORMAT("invalidRequestBodyFormat"), + + /** + * Enum value emptyRequest. + */ + EMPTY_REQUEST("emptyRequest"), + + /** + * Enum value missingInputRecords. + */ + MISSING_INPUT_RECORDS("missingInputRecords"), + + /** + * Enum value invalidDocument. + */ + INVALID_DOCUMENT("invalidDocument"), + + /** + * Enum value modelVersionIncorrect. + */ + MODEL_VERSION_INCORRECT("modelVersionIncorrect"), + + /** + * Enum value invalidDocumentBatch. + */ + INVALID_DOCUMENT_BATCH("invalidDocumentBatch"), + + /** + * Enum value unsupportedLanguageCode. + */ + UNSUPPORTED_LANGUAGE_CODE("unsupportedLanguageCode"), + + /** + * Enum value invalidCountryHint. + */ + INVALID_COUNTRY_HINT("invalidCountryHint"); + + /** + * The actual serialized value for a InnerErrorCodeValue instance. + */ + private final String value; + + InnerErrorCodeValue(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a InnerErrorCodeValue instance. + * + * @param value the serialized value to parse. + * @return the parsed InnerErrorCodeValue object, or null if unable to parse. + */ + @JsonCreator + public static InnerErrorCodeValue fromString(String value) { + InnerErrorCodeValue[] items = InnerErrorCodeValue.values(); + for (InnerErrorCodeValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java new file mode 100644 index 000000000000..7c19d60a2e5c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The KeyPhraseResult model. + */ +@Fluent +public final class KeyPhraseResult { + /* + * Response by document + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /* + * Errors by document id. + */ + @JsonProperty(value = "errors", required = true) + private List errors; + + /* + * The statistics property. + */ + @JsonProperty(value = "statistics") + private RequestStatistics statistics; + + /* + * This field indicates which model is used for scoring. + */ + @JsonProperty(value = "modelVersion", required = true) + private String modelVersion; + + /** + * Get the documents property: Response by document. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: Response by document. + * + * @param documents the documents value to set. + * @return the KeyPhraseResult object itself. + */ + public KeyPhraseResult setDocuments(List documents) { + this.documents = documents; + return this; + } + + /** + * Get the errors property: Errors by document id. + * + * @return the errors value. + */ + public List getErrors() { + return this.errors; + } + + /** + * Set the errors property: Errors by document id. + * + * @param errors the errors value to set. + * @return the KeyPhraseResult object itself. + */ + public KeyPhraseResult setErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the statistics property: The statistics property. + * + * @return the statistics value. + */ + public RequestStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: The statistics property. + * + * @param statistics the statistics value to set. + * @return the KeyPhraseResult object itself. + */ + public KeyPhraseResult setStatistics(RequestStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * + * @param modelVersion the modelVersion value to set. + * @return the KeyPhraseResult object itself. + */ + public KeyPhraseResult setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java new file mode 100644 index 000000000000..dff194489582 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageBatchInput.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The LanguageBatchInput model. + */ +@Fluent +public final class LanguageBatchInput { + /* + * The documents property. + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /** + * Get the documents property: The documents property. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: The documents property. + * + * @param documents the documents value to set. + * @return the LanguageBatchInput object itself. + */ + public LanguageBatchInput setDocuments(List documents) { + this.documents = documents; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java new file mode 100644 index 000000000000..da18b248fa8a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.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.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The LanguageInput model. + */ +@Fluent +public final class LanguageInput { + /* + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The text property. + */ + @JsonProperty(value = "text", required = true) + private String text; + + /* + * The countryHint property. + */ + @JsonProperty(value = "countryHint") + private String countryHint; + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the LanguageInput object itself. + */ + public LanguageInput setId(String id) { + this.id = id; + return this; + } + + /** + * Get the text property: The text property. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Set the text property: The text property. + * + * @param text the text value to set. + * @return the LanguageInput object itself. + */ + public LanguageInput setText(String text) { + this.text = text; + return this; + } + + /** + * Get the countryHint property: The countryHint property. + * + * @return the countryHint value. + */ + public String getCountryHint() { + return this.countryHint; + } + + /** + * Set the countryHint property: The countryHint property. + * + * @param countryHint the countryHint value to set. + * @return the LanguageInput object itself. + */ + public LanguageInput setCountryHint(String countryHint) { + this.countryHint = countryHint; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java new file mode 100644 index 000000000000..82e11308d49c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageResult.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The LanguageResult model. + */ +@Fluent +public final class LanguageResult { + /* + * Response by document + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /* + * Errors by document id. + */ + @JsonProperty(value = "errors", required = true) + private List errors; + + /* + * The statistics property. + */ + @JsonProperty(value = "statistics") + private RequestStatistics statistics; + + /* + * This field indicates which model is used for scoring. + */ + @JsonProperty(value = "modelVersion", required = true) + private String modelVersion; + + /** + * Get the documents property: Response by document. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: Response by document. + * + * @param documents the documents value to set. + * @return the LanguageResult object itself. + */ + public LanguageResult setDocuments(List documents) { + this.documents = documents; + return this; + } + + /** + * Get the errors property: Errors by document id. + * + * @return the errors value. + */ + public List getErrors() { + return this.errors; + } + + /** + * Set the errors property: Errors by document id. + * + * @param errors the errors value to set. + * @return the LanguageResult object itself. + */ + public LanguageResult setErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the statistics property: The statistics property. + * + * @return the statistics value. + */ + public RequestStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: The statistics property. + * + * @param statistics the statistics value to set. + * @return the LanguageResult object itself. + */ + public LanguageResult setStatistics(RequestStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * + * @param modelVersion the modelVersion value to set. + * @return the LanguageResult object itself. + */ + public LanguageResult setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java new file mode 100644 index 000000000000..0c3b2fd9f859 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The LinkedEntity model. + */ +@Fluent +public final class LinkedEntity { + /* + * Entity Linking formal name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * List of instances this entity appears in the text. + */ + @JsonProperty(value = "matches", required = true) + private List matches; + + /* + * Language used in the data source. + */ + @JsonProperty(value = "language", required = true) + private String language; + + /* + * Unique identifier of the recognized entity from the data source. + */ + @JsonProperty(value = "id") + private String id; + + /* + * URL for the entity's page from the data source. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /* + * Data source used to extract entity linking, such as Wiki/Bing etc. + */ + @JsonProperty(value = "dataSource", required = true) + private String dataSource; + + /** + * Get the name property: Entity Linking formal name. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: Entity Linking formal name. + * + * @param name the name value to set. + * @return the LinkedEntity object itself. + */ + public LinkedEntity setName(String name) { + this.name = name; + return this; + } + + /** + * Get the matches property: List of instances this entity appears in the + * text. + * + * @return the matches value. + */ + public List getMatches() { + return this.matches; + } + + /** + * Set the matches property: List of instances this entity appears in the + * text. + * + * @param matches the matches value to set. + * @return the LinkedEntity object itself. + */ + public LinkedEntity setMatches(List matches) { + this.matches = matches; + return this; + } + + /** + * Get the language property: Language used in the data source. + * + * @return the language value. + */ + public String getLanguage() { + return this.language; + } + + /** + * Set the language property: Language used in the data source. + * + * @param language the language value to set. + * @return the LinkedEntity object itself. + */ + public LinkedEntity setLanguage(String language) { + this.language = language; + return this; + } + + /** + * Get the id property: Unique identifier of the recognized entity from the + * data source. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Unique identifier of the recognized entity from the + * data source. + * + * @param id the id value to set. + * @return the LinkedEntity object itself. + */ + public LinkedEntity setId(String id) { + this.id = id; + return this; + } + + /** + * Get the url property: URL for the entity's page from the data source. + * + * @return the url value. + */ + public String getUrl() { + return this.url; + } + + /** + * Set the url property: URL for the entity's page from the data source. + * + * @param url the url value to set. + * @return the LinkedEntity object itself. + */ + public LinkedEntity setUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the dataSource property: Data source used to extract entity linking, + * such as Wiki/Bing etc. + * + * @return the dataSource value. + */ + public String getDataSource() { + return this.dataSource; + } + + /** + * Set the dataSource property: Data source used to extract entity linking, + * such as Wiki/Bing etc. + * + * @param dataSource the dataSource value to set. + * @return the LinkedEntity object itself. + */ + public LinkedEntity setDataSource(String dataSource) { + this.dataSource = dataSource; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java new file mode 100644 index 000000000000..cdd4e4a6fa18 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Match model. + */ +@Fluent +public final class Match { + /* + * If a well-known item is recognized, a decimal number denoting the + * confidence level between 0 and 1 will be returned. + */ + @JsonProperty(value = "score", required = true) + private double score; + + /* + * Entity text as appears in the request. + */ + @JsonProperty(value = "text", required = true) + private String text; + + /* + * Start position (in Unicode characters) for the entity match text. + */ + @JsonProperty(value = "offset", required = true) + private int offset; + + /* + * Length (in Unicode characters) for the entity match text. + */ + @JsonProperty(value = "length", required = true) + private int length; + + /** + * Get the score property: If a well-known item is recognized, a decimal + * number denoting the confidence level between 0 and 1 will be returned. + * + * @return the score value. + */ + public double getScore() { + return this.score; + } + + /** + * Set the score property: If a well-known item is recognized, a decimal + * number denoting the confidence level between 0 and 1 will be returned. + * + * @param score the score value to set. + * @return the Match object itself. + */ + public Match setScore(double score) { + this.score = score; + return this; + } + + /** + * Get the text property: Entity text as appears in the request. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Set the text property: Entity text as appears in the request. + * + * @param text the text value to set. + * @return the Match object itself. + */ + public Match setText(String text) { + this.text = text; + return this; + } + + /** + * Get the offset property: Start position (in Unicode characters) for the + * entity match text. + * + * @return the offset value. + */ + public int getOffset() { + return this.offset; + } + + /** + * Set the offset property: Start position (in Unicode characters) for the + * entity match text. + * + * @param offset the offset value to set. + * @return the Match object itself. + */ + public Match setOffset(int offset) { + this.offset = offset; + return this; + } + + /** + * Get the length property: Length (in Unicode characters) for the entity + * match text. + * + * @return the length value. + */ + public int getLength() { + return this.length; + } + + /** + * Set the length property: Length (in Unicode characters) for the entity + * match text. + * + * @param length the length value to set. + * @return the Match object itself. + */ + public Match setLength(int length) { + this.length = length; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.java new file mode 100644 index 000000000000..15e031e8696e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageBatchInput.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.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Contains a set of input documents to be analyzed by the service. + */ +@Fluent +public final class MultiLanguageBatchInput { + /* + * The set of documents to process as part of this batch. + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /** + * Get the documents property: The set of documents to process as part of + * this batch. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: The set of documents to process as part of + * this batch. + * + * @param documents the documents value to set. + * @return the MultiLanguageBatchInput object itself. + */ + public MultiLanguageBatchInput setDocuments(List documents) { + this.documents = documents; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java new file mode 100644 index 000000000000..3760d680181e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains an input document to be analyzed by the service. + */ +@Fluent +public final class MultiLanguageInput { + /* + * A unique, non-empty document identifier. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The input text to process. + */ + @JsonProperty(value = "text", required = true) + private String text; + + /* + * (Optional) This is the 2 letter ISO 639-1 representation of a language. + * For example, use "en" for English; "es" for Spanish etc. If not set, use + * "en" for English as default. + */ + @JsonProperty(value = "language") + private String language; + + /** + * Get the id property: A unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: A unique, non-empty document identifier. + * + * @param id the id value to set. + * @return the MultiLanguageInput object itself. + */ + public MultiLanguageInput setId(String id) { + this.id = id; + return this; + } + + /** + * Get the text property: The input text to process. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Set the text property: The input text to process. + * + * @param text the text value to set. + * @return the MultiLanguageInput object itself. + */ + public MultiLanguageInput setText(String text) { + this.text = text; + return this; + } + + /** + * Get the language property: (Optional) This is the 2 letter ISO 639-1 + * representation of a language. For example, use "en" for English; "es" + * for Spanish etc. If not set, use "en" for English as default. + * + * @return the language value. + */ + public String getLanguage() { + return this.language; + } + + /** + * Set the language property: (Optional) This is the 2 letter ISO 639-1 + * representation of a language. For example, use "en" for English; "es" + * for Spanish etc. If not set, use "en" for English as default. + * + * @param language the language value to set. + * @return the MultiLanguageInput object itself. + */ + public MultiLanguageInput setLanguage(String language) { + this.language = language; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java new file mode 100644 index 000000000000..b0934b055ab5 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * if showStats=true was specified in the request this field will contain + * information about the request payload. + */ +@Fluent +public final class RequestStatistics { + /* + * Number of documents submitted in the request. + */ + @JsonProperty(value = "documentsCount", required = true) + private int documentsCount; + + /* + * Number of valid documents. This excludes empty, over-size limit or + * non-supported languages documents. + */ + @JsonProperty(value = "validDocumentsCount", required = true) + private int validDocumentsCount; + + /* + * Number of invalid documents. This includes empty, over-size limit or + * non-supported languages documents. + */ + @JsonProperty(value = "erroneousDocumentsCount", required = true) + private int erroneousDocumentsCount; + + /* + * Number of transactions for the request. + */ + @JsonProperty(value = "transactionsCount", required = true) + private long transactionsCount; + + /** + * Get the documentsCount property: Number of documents submitted in the + * request. + * + * @return the documentsCount value. + */ + public int getDocumentsCount() { + return this.documentsCount; + } + + /** + * Set the documentsCount property: Number of documents submitted in the + * request. + * + * @param documentsCount the documentsCount value to set. + * @return the RequestStatistics object itself. + */ + public RequestStatistics setDocumentsCount(int documentsCount) { + this.documentsCount = documentsCount; + return this; + } + + /** + * Get the validDocumentsCount property: Number of valid documents. This + * excludes empty, over-size limit or non-supported languages documents. + * + * @return the validDocumentsCount value. + */ + public int getValidDocumentsCount() { + return this.validDocumentsCount; + } + + /** + * Set the validDocumentsCount property: Number of valid documents. This + * excludes empty, over-size limit or non-supported languages documents. + * + * @param validDocumentsCount the validDocumentsCount value to set. + * @return the RequestStatistics object itself. + */ + public RequestStatistics setValidDocumentsCount(int validDocumentsCount) { + this.validDocumentsCount = validDocumentsCount; + return this; + } + + /** + * Get the erroneousDocumentsCount property: Number of invalid documents. + * This includes empty, over-size limit or non-supported languages + * documents. + * + * @return the erroneousDocumentsCount value. + */ + public int getErroneousDocumentsCount() { + return this.erroneousDocumentsCount; + } + + /** + * Set the erroneousDocumentsCount property: Number of invalid documents. + * This includes empty, over-size limit or non-supported languages + * documents. + * + * @param erroneousDocumentsCount the erroneousDocumentsCount value to set. + * @return the RequestStatistics object itself. + */ + public RequestStatistics setErroneousDocumentsCount(int erroneousDocumentsCount) { + this.erroneousDocumentsCount = erroneousDocumentsCount; + return this; + } + + /** + * Get the transactionsCount property: Number of transactions for the + * request. + * + * @return the transactionsCount value. + */ + public long getTransactionsCount() { + return this.transactionsCount; + } + + /** + * Set the transactionsCount property: Number of transactions for the + * request. + * + * @param transactionsCount the transactionsCount value to set. + * @return the RequestStatistics object itself. + */ + public RequestStatistics setTransactionsCount(long transactionsCount) { + this.transactionsCount = transactionsCount; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java new file mode 100644 index 000000000000..47a29eb1e207 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The SentenceSentiment model. + */ +@Fluent +public final class SentenceSentiment { + /* + * The predicted Sentiment for the sentence. Possible values include: + * 'positive', 'neutral', 'negative' + */ + @JsonProperty(value = "sentiment", required = true) + private SentenceSentimentValue sentiment; + + /* + * The sentiment confidence score between 0 and 1 for the sentence for all + * classes. + */ + @JsonProperty(value = "sentenceScores", required = true) + private SentimentConfidenceScorePerLabel sentenceScores; + + /* + * The sentence offset from the start of the document. + */ + @JsonProperty(value = "offset", required = true) + private int offset; + + /* + * The length of the sentence by Unicode standard. + */ + @JsonProperty(value = "length", required = true) + private int length; + + /* + * The warnings generated for the sentence. + */ + @JsonProperty(value = "warnings") + private List warnings; + + /** + * Get the sentiment property: The predicted Sentiment for the sentence. + * Possible values include: 'positive', 'neutral', 'negative'. + * + * @return the sentiment value. + */ + public SentenceSentimentValue getSentiment() { + return this.sentiment; + } + + /** + * Set the sentiment property: The predicted Sentiment for the sentence. + * Possible values include: 'positive', 'neutral', 'negative'. + * + * @param sentiment the sentiment value to set. + * @return the SentenceSentiment object itself. + */ + public SentenceSentiment setSentiment(SentenceSentimentValue sentiment) { + this.sentiment = sentiment; + return this; + } + + /** + * Get the sentenceScores property: The sentiment confidence score between + * 0 and 1 for the sentence for all classes. + * + * @return the sentenceScores value. + */ + public SentimentConfidenceScorePerLabel getSentenceScores() { + return this.sentenceScores; + } + + /** + * Set the sentenceScores property: The sentiment confidence score between + * 0 and 1 for the sentence for all classes. + * + * @param sentenceScores the sentenceScores value to set. + * @return the SentenceSentiment object itself. + */ + public SentenceSentiment setSentenceScores(SentimentConfidenceScorePerLabel sentenceScores) { + this.sentenceScores = sentenceScores; + return this; + } + + /** + * Get the offset property: The sentence offset from the start of the + * document. + * + * @return the offset value. + */ + public int getOffset() { + return this.offset; + } + + /** + * Set the offset property: The sentence offset from the start of the + * document. + * + * @param offset the offset value to set. + * @return the SentenceSentiment object itself. + */ + public SentenceSentiment setOffset(int offset) { + this.offset = offset; + return this; + } + + /** + * Get the length property: The length of the sentence by Unicode standard. + * + * @return the length value. + */ + public int getLength() { + return this.length; + } + + /** + * Set the length property: The length of the sentence by Unicode standard. + * + * @param length the length value to set. + * @return the SentenceSentiment object itself. + */ + public SentenceSentiment setLength(int length) { + this.length = length; + return this; + } + + /** + * Get the warnings property: The warnings generated for the sentence. + * + * @return the warnings value. + */ + public List getWarnings() { + return this.warnings; + } + + /** + * Set the warnings property: The warnings generated for the sentence. + * + * @param warnings the warnings value to set. + * @return the SentenceSentiment object itself. + */ + public SentenceSentiment setWarnings(List warnings) { + this.warnings = warnings; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java new file mode 100644 index 000000000000..3a1d6dcb5fee --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SentenceSentimentValue. + */ +public enum SentenceSentimentValue { + /** + * Enum value positive. + */ + POSITIVE("positive"), + + /** + * Enum value neutral. + */ + NEUTRAL("neutral"), + + /** + * Enum value negative. + */ + NEGATIVE("negative"); + + /** + * The actual serialized value for a SentenceSentimentValue instance. + */ + private final String value; + + SentenceSentimentValue(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SentenceSentimentValue instance. + * + * @param value the serialized value to parse. + * @return the parsed SentenceSentimentValue object, or null if unable to parse. + */ + @JsonCreator + public static SentenceSentimentValue fromString(String value) { + SentenceSentimentValue[] items = SentenceSentimentValue.values(); + for (SentenceSentimentValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java new file mode 100644 index 000000000000..eea3ba7a45f3 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the confidence scores between 0 and 1 across all sentiment + * classes: positive, neutral, negative. + */ +@Fluent +public final class SentimentConfidenceScorePerLabel { + /* + * The positive property. + */ + @JsonProperty(value = "positive", required = true) + private double positive; + + /* + * The neutral property. + */ + @JsonProperty(value = "neutral", required = true) + private double neutral; + + /* + * The negative property. + */ + @JsonProperty(value = "negative", required = true) + private double negative; + + /** + * Get the positive property: The positive property. + * + * @return the positive value. + */ + public double getPositive() { + return this.positive; + } + + /** + * Set the positive property: The positive property. + * + * @param positive the positive value to set. + * @return the SentimentConfidenceScorePerLabel object itself. + */ + public SentimentConfidenceScorePerLabel setPositive(double positive) { + this.positive = positive; + return this; + } + + /** + * Get the neutral property: The neutral property. + * + * @return the neutral value. + */ + public double getNeutral() { + return this.neutral; + } + + /** + * Set the neutral property: The neutral property. + * + * @param neutral the neutral value to set. + * @return the SentimentConfidenceScorePerLabel object itself. + */ + public SentimentConfidenceScorePerLabel setNeutral(double neutral) { + this.neutral = neutral; + return this; + } + + /** + * Get the negative property: The negative property. + * + * @return the negative value. + */ + public double getNegative() { + return this.negative; + } + + /** + * Set the negative property: The negative property. + * + * @param negative the negative value to set. + * @return the SentimentConfidenceScorePerLabel object itself. + */ + public SentimentConfidenceScorePerLabel setNegative(double negative) { + this.negative = negative; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java new file mode 100644 index 000000000000..95a683f7cbb8 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The SentimentResponse model. + */ +@Fluent +public final class SentimentResponse { + /* + * Sentiment analysis per document. + */ + @JsonProperty(value = "documents", required = true) + private List documents; + + /* + * Errors by document id. + */ + @JsonProperty(value = "errors", required = true) + private List errors; + + /* + * The statistics property. + */ + @JsonProperty(value = "statistics") + private RequestStatistics statistics; + + /* + * This field indicates which model is used for scoring. + */ + @JsonProperty(value = "modelVersion", required = true) + private String modelVersion; + + /** + * Get the documents property: Sentiment analysis per document. + * + * @return the documents value. + */ + public List getDocuments() { + return this.documents; + } + + /** + * Set the documents property: Sentiment analysis per document. + * + * @param documents the documents value to set. + * @return the SentimentResponse object itself. + */ + public SentimentResponse setDocuments(List documents) { + this.documents = documents; + return this; + } + + /** + * Get the errors property: Errors by document id. + * + * @return the errors value. + */ + public List getErrors() { + return this.errors; + } + + /** + * Set the errors property: Errors by document id. + * + * @param errors the errors value to set. + * @return the SentimentResponse object itself. + */ + public SentimentResponse setErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the statistics property: The statistics property. + * + * @return the statistics value. + */ + public RequestStatistics getStatistics() { + return this.statistics; + } + + /** + * Set the statistics property: The statistics property. + * + * @param statistics the statistics value to set. + * @return the SentimentResponse object itself. + */ + public SentimentResponse setStatistics(RequestStatistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get the modelVersion property: This field indicates which model is used + * for scoring. + * + * @return the modelVersion value. + */ + public String getModelVersion() { + return this.modelVersion; + } + + /** + * Set the modelVersion property: This field indicates which model is used + * for scoring. + * + * @param modelVersion the modelVersion value to set. + * @return the SentimentResponse object itself. + */ + public SentimentResponse setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java new file mode 100644 index 000000000000..95cb995ac216 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsError.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The TextAnalyticsError model. + */ +@Fluent +public final class TextAnalyticsError { + /* + * Error code. Possible values include: 'invalidRequest', + * 'invalidArgument', 'internalServerError', 'serviceUnavailable' + */ + @JsonProperty(value = "code", required = true) + private ErrorCodeValue code; + + /* + * Error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /* + * Error target. + */ + @JsonProperty(value = "target") + private String target; + + /* + * Inner error contains more specific information. + */ + @JsonProperty(value = "innerError") + private InnerError innerError; + + /* + * Details about specific errors that led to this reported error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: Error code. Possible values include: + * 'invalidRequest', 'invalidArgument', 'internalServerError', + * 'serviceUnavailable'. + * + * @return the code value. + */ + public ErrorCodeValue getCode() { + return this.code; + } + + /** + * Set the code property: Error code. Possible values include: + * 'invalidRequest', 'invalidArgument', 'internalServerError', + * 'serviceUnavailable'. + * + * @param code the code value to set. + * @return the TextAnalyticsError object itself. + */ + public TextAnalyticsError setCode(ErrorCodeValue code) { + this.code = code; + return this; + } + + /** + * Get the message property: Error message. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Set the message property: Error message. + * + * @param message the message value to set. + * @return the TextAnalyticsError object itself. + */ + public TextAnalyticsError setMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target property: Error target. + * + * @return the target value. + */ + public String getTarget() { + return this.target; + } + + /** + * Set the target property: Error target. + * + * @param target the target value to set. + * @return the TextAnalyticsError object itself. + */ + public TextAnalyticsError setTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the innerError property: Inner error contains more specific + * information. + * + * @return the innerError value. + */ + public InnerError getInnerError() { + return this.innerError; + } + + /** + * Set the innerError property: Inner error contains more specific + * information. + * + * @param innerError the innerError value to set. + * @return the TextAnalyticsError object itself. + */ + public TextAnalyticsError setInnerError(InnerError innerError) { + this.innerError = innerError; + return this; + } + + /** + * Get the details property: Details about specific errors that led to this + * reported error. + * + * @return the details value. + */ + public List getDetails() { + return this.details; + } + + /** + * Set the details property: Details about specific errors that led to this + * reported error. + * + * @param details the details value to set. + * @return the TextAnalyticsError object itself. + */ + public TextAnalyticsError setDetails(List details) { + this.details = details; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java new file mode 100644 index 000000000000..25898ef8f43e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TextAnalyticsErrorException.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.implementation.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with TextAnalyticsError information. + */ +public final class TextAnalyticsErrorException extends HttpResponseException { + /** + * Initializes a new instance of the TextAnalyticsErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public TextAnalyticsErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the TextAnalyticsErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public TextAnalyticsErrorException(String message, HttpResponse response, TextAnalyticsError value) { + super(message, response, value); + } + + @Override + public TextAnalyticsError getValue() { + return (TextAnalyticsError) super.getValue(); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java new file mode 100644 index 000000000000..3e23bae65d86 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/package-info.java @@ -0,0 +1,16 @@ +// 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 TextAnalyticsClient. + * The Text Analytics API is a suite of text analytics web services built with + * best-in-class Microsoft machine learning algorithms. The API can be used to + * analyze unstructured text for tasks such as sentiment analysis, key phrase + * extraction and language detection. No training data is needed to use this + * API; just bring your text data. This API uses advanced natural language + * processing techniques to deliver best in class predictions. Further + * documentation can be found in + * https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + */ +package com.azure.ai.textanalytics.implementation.models; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java new file mode 100644 index 000000000000..14f77f46074d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/package-info.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations and inner classes for + * TextAnalyticsClient. + * The Text Analytics API is a suite of text analytics web services built with + * best-in-class Microsoft machine learning algorithms. The API can be used to + * analyze unstructured text for tasks such as sentiment analysis, key phrase + * extraction and language detection. No training data is needed to use this + * API; just bring your text data. This API uses advanced natural language + * processing techniques to deliver best in class predictions. Further + * documentation can be found in + * https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + */ +package com.azure.ai.textanalytics.implementation; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java new file mode 100644 index 000000000000..0439470d1120 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentResult.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The AnalyzeSentimentResult model. + */ +@Immutable +public final class AnalyzeSentimentResult extends DocumentResult { + private final TextSentiment documentSentiment; + private final List sentenceSentiments; + + /** + * Creates a {@code TextSentimentResult} model that describes analyzed sentiment result + * + * @param id unique, non-empty document identifier + * @param textDocumentStatistics text document statistics + * @param error the document error + * @param documentSentiment the document sentiment + * @param sentenceSentiments a list of sentence sentiments + */ + public AnalyzeSentimentResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error, + TextSentiment documentSentiment, List sentenceSentiments) { + super(id, textDocumentStatistics, error); + this.documentSentiment = documentSentiment; + this.sentenceSentiments = sentenceSentiments == null ? new ArrayList<>() : sentenceSentiments; + } + + /** + * Get the document sentiment. + * + * @return the document sentiment + */ + public TextSentiment getDocumentSentiment() { + return documentSentiment; + } + + /** + * Get a list of sentence sentiments. + * + * @return a list of sentence sentiments + */ + public List getSentenceSentiments() { + return sentenceSentiments; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageInput.java new file mode 100644 index 000000000000..bcb753666b0b --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageInput.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The DetectLanguageInput model. + */ +@Immutable +public final class DetectLanguageInput { + /* + * Unique, non-empty document identifier. + */ + private final String id; + + /* + * The text property. + */ + private final String text; + + /* + * The countryHint property. + */ + private final String countryHint; + + /** + * Creates an input for detect language that will takes {@code id} and {@code text} as required inputs + * + * @param id unique, non-empty document identifier + * @param text the text property + */ + public DetectLanguageInput(String id, String text) { + this(id, text, null); + } + + /** + * Creates an input for detect language that will takes {@code id}, {@code text} and {@code countryHint} + * + * @param id unique, non-empty document identifier + * @param text the text property + * @param countryHint the country hint + */ + public DetectLanguageInput(String id, String text, String countryHint) { + this.id = id; + this.text = text; + this.countryHint = countryHint; + } + + /** + * Get the id property: Unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Get the text property: The text property. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Get the countryHint property: The countryHint property. + * + * @return the countryHint value. + */ + public String getCountryHint() { + return this.countryHint; + } + + @Override + public String toString() { + return String.format("Text = %s, Id = %s, Country Hint = %s", + this.getText(), this.getId(), this.getCountryHint()); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java new file mode 100644 index 000000000000..9578e6a214d7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectLanguageResult.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The DetectedLanguageResult model. + */ +@Immutable +public final class DetectLanguageResult extends DocumentResult { + private final DetectedLanguage primaryLanguage; + private final List detectedLanguages; + + /** + * Create a {@code DetectedLanguageResult} model that describes detected languages result + * + * @param id Unique, non-empty document identifier. + * @param textDocumentStatistics text document statistics + * @param error the document error. + * @param primaryLanguage the detected primary language + * @param detectedLanguages a list of detected language result + */ + public DetectLanguageResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error, + DetectedLanguage primaryLanguage, List detectedLanguages) { + super(id, textDocumentStatistics, error); + this.primaryLanguage = primaryLanguage; + this.detectedLanguages = detectedLanguages == null ? new ArrayList<>() : detectedLanguages; + } + + /** + * Get the detected primary language + * + * @return the detected language + */ + public DetectedLanguage getPrimaryLanguage() { + return primaryLanguage; + } + + /** + * Get the list of detected languages + * + * @return the list of detected language + */ + public List getDetectedLanguages() { + return detectedLanguages; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectedLanguage.java new file mode 100644 index 000000000000..6121f3ced526 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DetectedLanguage.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The DetectedLanguage model. + */ +@Immutable +public final class DetectedLanguage { + /* + * Long name of a detected language (e.g. English, French). + */ + private final String name; + + /* + * A two letter representation of the detected language according to the + * ISO 639-1 standard (e.g. en, fr). + */ + private final String iso6391Name; + + /* + * A confidence score between 0 and 1. Scores close to 1 indicate 100% + * certainty that the identified language is true. + */ + private final double score; + + /** + * Creates a {@code DetectedLanguage} model that describes detected language content. + * + * @param name name of a detected language + * @param iso6391Name a two letter representation of the detected language according to the + * ISO 639-1 standard + * @param score a confidence score between 0 and 1 + */ + public DetectedLanguage(String name, String iso6391Name, double score) { + this.name = name; + this.iso6391Name = iso6391Name; + this.score = score; + } + + /** + * Get the name property: Long name of a detected language (e.g. English, + * French). + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Get the iso6391Name property: A two letter representation of the + * detected language according to the ISO 639-1 standard (e.g. en, fr). + * + * @return the iso6391Name value. + */ + public String getIso6391Name() { + return this.iso6391Name; + } + + /** + * Get the score property: A confidence score between 0 and 1. Scores close + * to 1 indicate 100% certainty that the identified language is true. + * + * @return the score value. + */ + public double getScore() { + return this.score; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResult.java new file mode 100644 index 000000000000..ae5c503ac837 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResult.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The DocumentResult model. + */ +@Immutable +public class DocumentResult { + private final String id; + private final TextDocumentStatistics textDocumentStatistics; + private final TextAnalyticsError error; + private final boolean isError; + + /** + * Create a {@code DocumentResult} model that maintains document id, information about the document payload, + * and document error + * + * @param id unique, non-empty document identifier + * @param textDocumentStatistics text document statistics + * @param error the document error. + */ + DocumentResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error) { + this.id = id; + this.error = error; + this.isError = error != null; + this.textDocumentStatistics = textDocumentStatistics; + } + + /** + * Get the document id + * + * @return the document id + */ + public String getId() { + return id; + } + + /** + * Get the statistics of the text document + * + * @return the {@link TextDocumentStatistics} statistics of the text document + */ + public TextDocumentStatistics getStatistics() { + return textDocumentStatistics; + } + + /** + * Get the error of text document + * + * @return the error of text document + */ + public TextAnalyticsError getError() { + return error; + } + + /** + * Get the boolean value indicates if the document result is error or not + * + * @return A boolean indicates if the document result is error or not + */ + public boolean isError() { + return isError; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResultCollection.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResultCollection.java new file mode 100644 index 000000000000..0b3082eb8554 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/DocumentResultCollection.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.IterableStream; + +/** + * The DocumentResultCollection model. + * + * @param the type of DocumentResultCollection holds + */ +@Immutable +public final class DocumentResultCollection extends IterableStream { + + private final String modelVersion; + private final TextDocumentBatchStatistics statistics; + + /** + * Create a document result collection + * + * @param iterable a generic iterable that takes type T + * @param modelVersion model version + * @param statistics Text batch statistics + */ + public DocumentResultCollection(Iterable iterable, String modelVersion, TextDocumentBatchStatistics statistics) { + super(iterable); + this.modelVersion = modelVersion; + this.statistics = statistics; + } + + /** + * Get model version + * + * @return model version + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Get statistics of the batch documents + * + * @return the statistics of the batch documents + */ + public TextDocumentBatchStatistics getStatistics() { + return statistics; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ErrorCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ErrorCodeValue.java new file mode 100644 index 000000000000..08bf0130510d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ErrorCodeValue.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ErrorCodeValue. + */ +public enum ErrorCodeValue { + /** + * Enum value invalidRequest. + */ + INVALID_REQUEST("invalidRequest"), + + /** + * Enum value invalidArgument. + */ + INVALID_ARGUMENT("invalidArgument"), + + /** + * Enum value internalServerError. + */ + INTERNAL_SERVER_ERROR("internalServerError"), + + /** + * Enum value serviceUnavailable. + */ + SERVICE_UNAVAILABLE("serviceUnavailable"); + + /** + * The actual serialized value for a ErrorCodeValue instance. + */ + private final String value; + + /** + * Creates a {@code ErrorCodeValue} model that describes error code value, 'invalidRequest', 'invalidArgument', + * 'internalServerError', or 'serviceUnavailable'. + * + * @param value the enum value for the error code value + */ + ErrorCodeValue(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ErrorCodeValue instance. + * + * @param value the serialized value to parse. + * @return the parsed ErrorCodeValue object, or null if unable to parse. + */ + @JsonCreator + public static ErrorCodeValue fromString(String value) { + ErrorCodeValue[] items = ErrorCodeValue.values(); + for (ErrorCodeValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java new file mode 100644 index 000000000000..74ecf96f63f3 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractKeyPhraseResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The ExtractKeyPhraseResult model. + */ +@Immutable +public final class ExtractKeyPhraseResult extends DocumentResult { + private final List keyPhrases; + + /** + * Create a {@code KeyPhraseResult} model that describes extracted key phrases result + * + * @param id Unique, non-empty document identifier. + * @param textDocumentStatistics text document statistics + * @param error the document error. + * @param keyPhrases a list of key phrases string + */ + public ExtractKeyPhraseResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error, + List keyPhrases) { + super(id, textDocumentStatistics, error); + this.keyPhrases = keyPhrases == null ? new ArrayList<>() : keyPhrases; + } + + /** + * Get a list of key phrase string + * + * @return a list of key phrase string + */ + public List getKeyPhrases() { + return keyPhrases; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/InnerError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/InnerError.java new file mode 100644 index 000000000000..60f5e7452c3a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/InnerError.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The InnerError model. + */ +@Immutable +public final class InnerError { + /* + * Error code. Possible values include: 'invalidParameterValue', + * 'invalidRequestBodyFormat', 'emptyRequest', 'missingInputRecords', + * 'invalidDocument', 'modelVersionIncorrect', 'invalidDocumentBatch', + * 'unsupportedLanguageCode', 'invalidCountryHint' + */ + private final String code; + + /* + * Error message. + */ + private final String message; + + /* + * Error target. + */ + private final String target; + + /* + * Inner error contains more specific information. + */ + private final InnerError innererror; + + /** + * Creates a {@code InnerError} model that describes inner error information. + * + * @param code error code + * @param message error message + * @param target error target + * @param innerError inner error contains more specific information + */ + public InnerError(String code, String message, String target, InnerError innerError) { + this.code = code; + this.message = message; + this.target = target; + this.innererror = innerError; + } + + /** + * Get the code property: Error code. Possible values include: + * 'invalidParameterValue', 'invalidRequestBodyFormat', 'emptyRequest', + * 'missingInputRecords', 'invalidDocument', 'modelVersionIncorrect', + * 'invalidDocumentBatch', 'unsupportedLanguageCode', 'invalidCountryHint'. + * + * @return the code value. + */ + public String getCode() { + return this.code; + } + + /** + * Get the message property: Error message. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Get the target property: Error target. + * + * @return the target value. + */ + public String getTarget() { + return this.target; + } + + /** + * Get the innererror property: Inner error contains more specific + * information. + * + * @return the innererror value. + */ + public InnerError getInnererror() { + return this.innererror; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java new file mode 100644 index 000000000000..dad5bb0a088e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntity.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.List; + +/** + * The LinkedEntity model. + */ +@Immutable +public final class LinkedEntity { + /* + * Entity Linking formal name. + */ + private final String name; + + /* + * List of instances this entity appears in the text. + */ + private final List linkedEntityMatches; + + /* + * Language used in the data source. + */ + private final String language; + + /* + * Unique identifier of the recognized entity from the data source. + */ + private final String id; + + /* + * URL for the entity's page from the data source. + */ + private final String url; + + /* + * Data source used to extract entity linking, such as Wiki/Bing etc. + */ + private final String dataSource; + + /** + * Creates a {@code LinkedEntity} model that describes linked entity. + * + * @param name entity Linking formal name + * @param linkedEntityMatches list of instances this entity appears in the text + * @param language language used in the data source + * @param id unique identifier of the recognized entity from the data source + * @param url URL for the entity's page from the data source + * @param dataSource data source used to extract entity linking, such as Wiki/Bing etc + */ + public LinkedEntity(String name, List linkedEntityMatches, String language, String id, + String url, String dataSource) { + this.name = name; + this.linkedEntityMatches = linkedEntityMatches; + this.language = language; + this.id = id; + this.url = url; + this.dataSource = dataSource; + } + + /** + * Get the name property: Entity Linking formal name. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Get the linkedEntityMatches property: List of instances this entity appears in the + * text. + * + * @return the linkedEntityMatches value. + */ + public List getLinkedEntityMatches() { + return this.linkedEntityMatches; + } + + /** + * Get the language property: Language used in the data source. + * + * @return the language value. + */ + public String getLanguage() { + return this.language; + } + + /** + * Get the id property: Unique identifier of the recognized entity from the + * data source. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Get the url property: URL for the entity's page from the data source. + * + * @return the url value. + */ + public String getUrl() { + return this.url; + } + + /** + * Get the dataSource property: Data source used to extract entity linking, + * such as Wiki/Bing etc. + * + * @return the dataSource value. + */ + public String getDataSource() { + return this.dataSource; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java new file mode 100644 index 000000000000..90b8eaad443a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/LinkedEntityMatch.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The LinkedEntityMatch model. + */ +@Immutable +public final class LinkedEntityMatch { + /* + * If a well-known item is recognized, a decimal number denoting the + * confidence level between 0 and 1 will be returned. + */ + private final double score; + + /* + * Entity text as appears in the request. + */ + private final String text; + + /* + * Start position (in Unicode characters) for the entity match text. + */ + private final int offset; + + /* + * Length (in Unicode characters) for the entity match text. + */ + private final int length; + + /** + * Creates a {@code LinkedEntityMatch} model that describes linked entity match. + * + * @param text entity text as appears in the request + * @param score if a well-known item is recognized, a decimal number denoting the + * confidence level between 0 and 1 will be returned + * @param offset start position (in Unicode characters) for the entity match text + * @param length length (in Unicode characters) for the entity match text + */ + public LinkedEntityMatch(String text, double score, int offset, int length) { + this.text = text; + this.score = score; + this.offset = offset; + this.length = length; + } + + /** + * Get the score property: If a well-known item is recognized, a decimal + * number denoting the confidence level between 0 and 1 will be returned. + * + * @return the score value. + */ + public double getScore() { + return this.score; + } + + /** + * Get the text property: Entity text as appears in the request. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Get the offset property: Start position (in Unicode characters) for the + * entity match text. + * + * @return the offset value. + */ + public int getOffset() { + return this.offset; + } + + /** + * Get the length property: Length (in Unicode characters) for the entity + * match text. + * + * @return the length value. + */ + public int getLength() { + return this.length; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/NamedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/NamedEntity.java new file mode 100644 index 000000000000..83256c55c788 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/NamedEntity.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The NamedEntity model. + */ +@Immutable +public final class NamedEntity { + /* + * NamedEntity text as appears in the request. + */ + private final String text; + + /* + * NamedEntity type, such as Person/Location/Org/SSN etc + */ + private final String type; + + /* + * NamedEntity sub type, such as Age/Year/TimeRange etc + */ + private final String subtype; + + /* + * Start position (in Unicode characters) for the entity text. + */ + private final int offset; + + /* + * Length (in Unicode characters) for the entity text. + */ + private final int length; + + /* + * Confidence score between 0 and 1 of the extracted entity. + */ + private final double score; + + /** + * Creates a {@code NamedEntity} model that describes entity. + * + * @param text namedEntity text as appears in the request + * @param type namedEntity type, such as Person/Location/Org/SSN etc + * @param subtype namedEntity sub type, such as Age/Year/TimeRange etc + * @param offset start position (in Unicode characters) for the entity text + * @param length length (in Unicode characters) for the entity text + * @param score confidence score between 0 and 1 of the extracted entity + */ + public NamedEntity(String text, String type, String subtype, int offset, int length, double score) { + this.text = text; + this.type = type; + this.subtype = subtype; + this.offset = offset; + this.length = length; + this.score = score; + } + + /** + * Get the text property: NamedEntity text as appears in the request. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Get the type property: NamedEntity type, such as Person/Location/Org/SSN etc. + * + * @return the type value. + */ + public String getType() { + return this.type; + } + + /** + * Get the subtype property: NamedEntity sub type, such as Age/Year/TimeRange + * etc. + * + * @return the subtype value. + */ + public String getSubtype() { + return this.subtype; + } + + /** + * Get the offset property: Start position (in Unicode characters) for the + * entity text. + * + * @return the offset value. + */ + public int getOffset() { + return this.offset; + } + + /** + * Get the length property: Length (in Unicode characters) for the entity + * text. + * + * @return the length value. + */ + public int getLength() { + return this.length; + } + + /** + * Get the score property: Confidence score between 0 and 1 of the + * extracted entity. + * + * @return the score value. + */ + public double getScore() { + return this.score; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java new file mode 100644 index 000000000000..1821f6b9ce57 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeEntitiesResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The RecognizeEntitiesResult model. + */ +@Immutable +public final class RecognizeEntitiesResult extends DocumentResult { + private final List namedEntities; + + /** + * Creates a {@code RecognizeEntitiesResult} model that describes recognized entities result + * + * @param id unique, non-empty document identifier + * @param textDocumentStatistics text document statistics + * @param error the document error + * @param namedEntities a list of {@link NamedEntity} + */ + public RecognizeEntitiesResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error, + List namedEntities) { + super(id, textDocumentStatistics, error); + this.namedEntities = namedEntities == null ? new ArrayList<>() : namedEntities; + } + + /** + * Get a list of named entities string + * + * @return a list of {@link NamedEntity} + */ + public List getNamedEntities() { + return namedEntities; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java new file mode 100644 index 000000000000..adc71b5ccc87 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizeLinkedEntitiesResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The RecognizeLinkedEntitiesResult model. + */ +@Immutable +public final class RecognizeLinkedEntitiesResult extends DocumentResult { + private final List linkedEntities; + + /** + * Creates a {@code RecognizeLinkedEntitiesResult} model that describes recognized linked entities result + * + * @param id unique, non-empty document identifier + * @param textDocumentStatistics text document statistics + * @param error the document error + * @param linkedEntities a list of linked entities + */ + public RecognizeLinkedEntitiesResult(String id, TextDocumentStatistics textDocumentStatistics, + TextAnalyticsError error, List linkedEntities) { + super(id, textDocumentStatistics, error); + this.linkedEntities = linkedEntities == null ? new ArrayList<>() : linkedEntities; + } + + /** + * Get a list of linked entities + * + * @return a list of linked entities. + */ + public List getLinkedEntities() { + return linkedEntities; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java new file mode 100644 index 000000000000..dc07bcf5edf7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/RecognizePiiEntitiesResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The RecognizePiiEntitiesResult model. + */ +@Immutable +public final class RecognizePiiEntitiesResult extends DocumentResult { + private final List namedEntities; + + /** + * Creates a {@code RecognizePiiEntitiesResult} model that describes recognized entities result + * + * @param id unique, non-empty document identifier + * @param textDocumentStatistics text document statistics + * @param error the document error + * @param namedEntities a list of {@link NamedEntity} + */ + public RecognizePiiEntitiesResult(String id, TextDocumentStatistics textDocumentStatistics, + TextAnalyticsError error, List namedEntities) { + super(id, textDocumentStatistics, error); + this.namedEntities = namedEntities == null ? new ArrayList<>() : namedEntities; + } + + /** + * Get a list of named entities string + * + * @return a list of {@link NamedEntity} + */ + public List getNamedEntities() { + return namedEntities; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsClientOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsClientOptions.java new file mode 100644 index 000000000000..1c8dd804dc04 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsClientOptions.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Fluent; + +/** + * The TextAnalyticsClientOptions model. + */ +@Fluent +public final class TextAnalyticsClientOptions { + private String defaultLanguage; + private String defaultCountryHint; + + /** + * Get the default language. + * + * @return the default language + */ + public String getDefaultLanguage() { + return this.defaultLanguage; + } + + /** + * Set the default language. + * + * @param defaultLanguage the default language + * @return the TextAnalyticsClientOptions object itself + */ + public TextAnalyticsClientOptions setDefaultLanguage(String defaultLanguage) { + this.defaultLanguage = defaultLanguage; + return this; + } + + /** + * Get the default country hint. + * + * @return the default country hint + */ + public String getDefaultCountryHint() { + return this.defaultCountryHint; + } + + /** + * Set the default country hint. + * + * @param defaultCountryHint the default country hint + * @return the TextAnalyticsClientOptions object itself + */ + public TextAnalyticsClientOptions setDefaultCountryHint(String defaultCountryHint) { + this.defaultCountryHint = defaultCountryHint; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsError.java new file mode 100644 index 000000000000..80e42eedc478 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsError.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The TextAnalyticsError model. + */ +@Immutable +public final class TextAnalyticsError { + /* + * Error code. Possible values include: 'invalidRequest', + * 'invalidArgument', 'internalServerError', 'serviceUnavailable' + */ + private final ErrorCodeValue code; + + /* + * Error message. + */ + private final String message; + + /* + * Error target. + */ + private final String target; + + /* + * Details about specific errors that led to this reported error. + */ + private final List details; + + /** + * Creates a {@code TextAnalyticsError} model that describes text analytics error. + * + * @param code error code + * @param message error message + * @param target error target + * @param details details about specific errors that led to this reported error + */ + public TextAnalyticsError(ErrorCodeValue code, String message, String target, List details) { + this.code = code; + this.message = message; + this.target = target; + this.details = details == null ? new ArrayList<>() : details; + } + + /** + * Get the code property: Error code. Possible values include: + * 'invalidRequest', 'invalidArgument', 'internalServerError', + * 'serviceUnavailable'. + * + * @return the code value. + */ + public ErrorCodeValue getCode() { + return this.code; + } + + /** + * Get the message property: Error message. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Get the target property: Error target. + * + * @return the target value. + */ + public String getTarget() { + return this.target; + } + + /** + * Get the details property: Details about specific errors that led to this + * reported error. + * + * @return the details value. + */ + public List getDetails() { + return this.details; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java new file mode 100644 index 000000000000..3aa07c1c411a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Fluent; + +/** + * The TextAnalyticsRequestOptions model. + */ +@Fluent +public final class TextAnalyticsRequestOptions { + private String modelVersion; + private boolean showStatistics; + + /** + * Gets the version of the text analytics model used by this operation. + * + * @return the model version + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Set the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". + * If a model-version is not specified, the API will default to the latest, non-preview version. + * + * @param modelVersion the model version + * @return the TextAnalyticsRequestOptions object itself + */ + public TextAnalyticsRequestOptions setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * Get the value of {@code showStatistics} + * + * @return the value of {@code showStatistics} + */ + public boolean showStatistics() { + return showStatistics; + } + + /** + * Set the value of {@code showStatistics} + * + * @param showStatistics if a boolean value was specified in the request this field will contain + * information about the document payload + * @return the TextAnalyticsRequestOptions object itself + */ + public TextAnalyticsRequestOptions setShowStatistics(boolean showStatistics) { + this.showStatistics = showStatistics; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentBatchStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentBatchStatistics.java new file mode 100644 index 000000000000..1c1baa5e27a2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentBatchStatistics.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * If {@link TextAnalyticsRequestOptions#showStatistics()} is set to {@code true} this class will will contain + * information about the request payload. + */ +@Immutable +public final class TextDocumentBatchStatistics { + /* + * Number of documents submitted in the request. + */ + private final int documentCount; + + /* + * Number of valid documents. This excludes empty, over-size limit or + * non-supported languages documents. + */ + private final int validDocumentCount; + + /* + * Number of invalid documents. This includes empty, over-size limit or + * non-supported languages documents. + */ + private final int erroneousDocumentCount; + + /* + * Number of transactions for the request. + */ + private final long transactionCount; + + /** + * Creates a {@code TextDocumentBatchStatistics} model that describes the statistics of batch text + * + * @param documentCount number of documents submitted in the request + * @param validDocumentCount number of valid documents. This excludes empty, over-size limit or + * non-supported languages documents + * @param erroneousDocumentCount Number of invalid documents. This includes empty, over-size limit or + * non-supported languages documents + * @param transactionCount number of transactions for the request + */ + public TextDocumentBatchStatistics(int documentCount, int validDocumentCount, int erroneousDocumentCount, + long transactionCount) { + this.documentCount = documentCount; + this.validDocumentCount = validDocumentCount; + this.erroneousDocumentCount = erroneousDocumentCount; + this.transactionCount = transactionCount; + } + + /** + * Get the documentCount property: Number of documents submitted in the + * request. + * + * @return the documentCount value. + */ + public int getDocumentCount() { + return this.documentCount; + } + + /** + * Get the validDocumentCount property: Number of valid documents. This + * excludes empty, over-size limit or non-supported languages documents. + * + * @return the validDocumentCount value. + */ + public int getValidDocumentCount() { + return this.validDocumentCount; + } + + /** + * Get the erroneousDocumentCount property: Number of invalid documents. + * This includes empty, over-size limit or non-supported languages + * documents. + * + * @return the erroneousDocumentCount value. + */ + public int getErroneousDocumentCount() { + return this.erroneousDocumentCount; + } + + /** + * Get the transactionCount property: Number of transactions for the + * request. + * + * @return the transactionCount value. + */ + public long getTransactionCount() { + return this.transactionCount; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentInput.java new file mode 100644 index 000000000000..d23b3541b232 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentInput.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * Contains an input document to be analyzed by the service. + */ +@Immutable +public final class TextDocumentInput { + + /* + * A unique, non-empty document identifier. + */ + private final String id; + + /* + * The input text to process. + */ + private final String text; + + /* + * (Optional) This is the 2 letter ISO 639-1 representation of a language. + * For example, use "en" for English; "es" for Spanish etc. If not set, use + * "en" for English as default. + */ + private final String language; + + /** + * Creates a {@code TextDocumentInput} model that describes the text inputs. + * + * @param id a unique, non-empty document identifier + * @param text the input text to process + */ + public TextDocumentInput(String id, String text) { + this(id, text, null); + } + + /** + * Creates a {@code TextDocumentInput} model that describes the text inputs. + * + * @param id a unique, non-empty document identifier + * @param text the input text to process + * @param language Optional. This is the 2 letter ISO 639-1 representation of a language + */ + public TextDocumentInput(String id, String text, String language) { + this.id = id; + this.text = text; + this.language = language; + } + + /** + * Get the id property: A unique, non-empty document identifier. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Get the text property: The input text to process. + * + * @return the text value. + */ + public String getText() { + return this.text; + } + + /** + * Get the language property: (Optional) This is the 2 letter ISO 639-1 + * representation of a language. For example, use "en" for English; "es" + * for Spanish etc. If not set, use "en" for English as default. + * + * @return the language value. + */ + public String getLanguage() { + return this.language; + } + + @Override + public String toString() { + return String.format("Text = %s, Id = %s, Language = %s", + this.getText(), this.getId(), this.getLanguage()); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentStatistics.java new file mode 100644 index 000000000000..4b2a00d37263 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextDocumentStatistics.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * If {@link TextAnalyticsRequestOptions#showStatistics()} is set to {@code true} this class will will contain + * information about the document payload. + */ +@Immutable +public final class TextDocumentStatistics { + /* + * Number of text elements recognized in the document. + */ + private final int characterCount; + + /* + * Number of transactions for the document. + */ + private final int transactionCount; + + /** + * Creates a {@code TextDocumentStatistics} model that describes the statistics of text document. + * + * @param characterCount number of text elements recognized in the document + * @param transactionCount number of transactions for the document + */ + public TextDocumentStatistics(int characterCount, int transactionCount) { + this.characterCount = characterCount; + this.transactionCount = transactionCount; + } + + /** + * Get the charactersCount property: Number of text elements recognized in + * the document. + * + * @return the charactersCount value. + */ + public int getCharacterCount() { + return this.characterCount; + } + + /** + * Get the transactionsCount property: Number of transactions for the + * document. + * + * @return the transactionsCount value. + */ + public int getTransactionCount() { + return this.transactionCount; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentiment.java new file mode 100644 index 000000000000..969f615f6487 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentiment.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; + +/** + * The TextSentiment model. + */ +@Immutable +public final class TextSentiment { + private final double negativeScore; + private final double neutralScore; + private final double positiveScore; + private final int length; + private final int offset; + private final TextSentimentClass textSentimentClass; + + /** + * Creates a {@code TextSentiment} model that describes the sentiment analysis of text + * + * @param textSentimentClass text sentiment class of text + * @param negativeScore negative score value, range in between 0 and 1.0 + * @param neutralScore neutral score value, range in between 0 and 1.0 + * @param positiveScore positive score value, range in between 0 and 1.0 + * @param length length of the text + * @param offset the offset from the start of the document + */ + public TextSentiment(TextSentimentClass textSentimentClass, double negativeScore, double neutralScore, + double positiveScore, int length, int offset) { + this.negativeScore = negativeScore; + this.neutralScore = neutralScore; + this.positiveScore = positiveScore; + this.length = length; + this.offset = offset; + this.textSentimentClass = textSentimentClass; + } + + /** + * Get the length of the text by Unicode standard. + * + * @return the length of the text by Unicode standard + */ + public int getLength() { + return length; + } + + /** + * Get the score of negative sentiment. + * + * @return the score of negative sentiment + */ + public double getNegativeScore() { + return negativeScore; + } + + /** + * Get the score of neutral sentiment. + * + * @return the score of neutral sentiment + */ + public double getNeutralScore() { + return neutralScore; + } + + /** + * Get the score of positive sentiment. + * + * @return the score of positive sentiment + */ + public double getPositiveScore() { + return positiveScore; + } + + /** + * Get the offset of the text sentiment. + * + * @return the offset of text sentiment + */ + public int getOffset() { + return offset; + } + + /** + * Get the text sentiment enum class: POSITIVE, NEGATIVE, NEUTRAL, MIXED. + * + * @return the TextSentimentClass + */ + public TextSentimentClass getTextSentimentClass() { + return textSentimentClass; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentimentClass.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentimentClass.java new file mode 100644 index 000000000000..35b1a5a22c74 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextSentimentClass.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DocumentSentimentValue. + */ +public enum TextSentimentClass { + /** + * Enum value positive. + */ + POSITIVE("positive"), + + /** + * Enum value neutral. + */ + NEUTRAL("neutral"), + + /** + * Enum value negative. + */ + NEGATIVE("negative"), + + /** + * Enum value mixed. + */ + MIXED("mixed"); + + /** + * The actual serialized value for a DocumentSentimentValue instance. + */ + private final String value; + + /** + * Creates a {@code TextSentimentClass} enum model that describes the sentiment class of text + * + * @param value an enum value, could be positive, neutral, negative, or mixed + */ + TextSentimentClass(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DocumentSentimentValue instance. + * + * @param value the serialized value to parse. + * @return the parsed DocumentSentimentValue object, or null if unable to parse. + */ + @JsonCreator + public static TextSentimentClass fromString(String value) { + TextSentimentClass[] items = TextSentimentClass.values(); + for (TextSentimentClass item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/package-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/package-info.java new file mode 100644 index 000000000000..7e1242b3f2c2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/package-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing classes for TextAnalyticsClient. + * The Text Analytics API is a suite of text analytics web services built with + * best-in-class Microsoft machine learning algorithms. The API can be used to + * analyze unstructured text for tasks such as sentiment analysis, key phrase + * extraction and language detection. No training data is needed to use this + * API; just bring your text data. This API uses advanced natural language + * processing techniques to deliver best in class predictions. Further + * documentation can be found in + * https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + */ +package com.azure.ai.textanalytics.models; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/package-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/package-info.java new file mode 100644 index 000000000000..6a74fe88bbba --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +/** + * Package containing classes for creating a {@link com.azure.ai.textanalytics.TextAnalyticsClient} to + * perform operations on Azure Text Analytics + */ +package com.azure.ai.textanalytics; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/module-info.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/module-info.java new file mode 100644 index 000000000000..bf8e8945476e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/module-info.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +module com.azure.ai.textanalytics { + requires transitive com.azure.core; + requires com.fasterxml.jackson.annotation; + + exports com.azure.ai.textanalytics; + exports com.azure.ai.textanalytics.models; + + opens com.azure.ai.textanalytics.implementation to com.fasterxml.jackson.databind; + opens com.azure.ai.textanalytics.models to com.fasterxml.jackson.databind; + opens com.azure.ai.textanalytics.implementation.models to com.fasterxml.jackson.databind; +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/resources/azure-ai-textanalytics.properties b/sdk/textanalytics/azure-ai-textanalytics/src/main/resources/azure-ai-textanalytics.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/resources/azure-ai-textanalytics.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md b/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md new file mode 100644 index 000000000000..e0a37e74a2b4 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/README.md @@ -0,0 +1,69 @@ + +## Azure Text Analytics client library for Java Samples + +Azure Text Analytics samples are a set of self-contained Java programs that demonstrate interacting with Azure Text Analytics service +using the client library. Each sample focuses on a specific scenario and can be executed independently. + +## Key concepts +Key concepts are explained in detail [here][SDK_README_KEY_CONCEPTS]. + +# Samples Azure Text Analytics APIs +This document describes how to use samples and what is done in each sample. + +## Getting started +Getting started explained in detail [here][SDK_README_GETTING_STARTED]. + +## Examples +The following sections provide several code snippets covering some of the most common configuration service tasks, including: + +- [Detect language in text][sample_hello_world] +- [Recognize entities in text][sample_entities] +- [Recognize personally identifiable information in text][sample_pii_entities] +- [Recognize linked entities in text][sample_linked_entities] +- [Extract key phrases in text][sample_key_phrases] +- [Analyze sentiment in text.][sample_sentiment] +- [Async Detect language in text][async_sample_hello_world] + +Batch Samples: +- [Detect language for a batch of documents][sample_language_batch] +- [Recognize entities in a batch of documents][sample_entities_batch] +- [Recognize personally identifiable information in a batch of documents][sample_pii_entities_batch] +- [Recognize linked entities in a batch of documents][sample_linked_entities_batch] +- [Extract key phrases in a batch of documents][sample_key_phrases_batch] +- [Analyze sentiment in a batch of documents][sample_sentiment_batch] + +## Troubleshooting +Troubleshooting steps can be found [here][SDK_README_TROUBLESHOOTING]. + +## Next steps +See [Next steps][SDK_README_NEXT_STEPS]. + +## Contributing +If you would like to become an active contributor to this project please refer to our [Contribution +Guidelines](../../CONTRIBUTING.md) for more information. + + +[KEYS_SDK_README]: ../../README.md +[SDK_README_CONTRIBUTING]: ../../README.md#contributing +[SDK_README_GETTING_STARTED]: ../../README.md#getting-started +[SDK_README_TROUBLESHOOTING]: ../../README.md#troubleshooting +[SDK_README_KEY_CONCEPTS]: ../../README.md#key-concepts +[SDK_README_DEPENDENCY]: ../../README.md#adding-the-package-to-your-product +[SDK_README_NEXT_STEPS]: ../../README.md#next-steps + +[async_sample_hello_world]: java/com/azure/ai/textanalytics/DetectLanguageAsync.java +[sample_hello_world]: java/com/azure/ai/textanalytics/DetectLanguage.java +[sample_entities]: java/com/azure/ai/textanalytics/RecognizeEntities.java +[sample_pii_entities]: java/com/azure/ai/textanalytics/RecognizePii.java +[sample_linked_entities]: java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java +[sample_key_phrases]: java/com/azure/ai/textanalytics/ExtractKeyPhrases.java +[sample_sentiment]: java/com/azure/ai/textanalytics/AnalyzeSentiment.java + +[sample_language_batch]: java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java +[sample_entities_batch]: java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java +[sample_pii_entities_batch]: java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocuments.java +[sample_linked_entities_batch]: java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java +[sample_key_phrases_batch]: java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocuments.java +[sample_sentiment_batch]: java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Ftextanalytics%2Fazure-ai-textanalytics%2FREADME.png) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentiment.java new file mode 100644 index 000000000000..33c55e930677 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentiment.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.TextSentiment; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; + +/** + * Sample demonstrates how to analyze the sentiment of an input text. + */ +public class AnalyzeSentiment { + /** + * Main method to invoke this demo about how to analyze the sentiment of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "The hotel was dark and unclean."; + + final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); + + final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); + System.out.printf( + "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", + documentSentiment.getTextSentimentClass(), + documentSentiment.getPositiveScore(), + documentSentiment.getNeutralScore(), + documentSentiment.getNegativeScore()); + + for (TextSentiment textSentiment : sentimentResult.getSentenceSentiments()) { + System.out.printf( + "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", + textSentiment.getTextSentimentClass(), + textSentiment.getPositiveScore(), + textSentiment.getNeutralScore(), + textSentiment.getNegativeScore()); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java new file mode 100644 index 000000000000..66339c3867bd --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.TextSentiment; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously analyze the sentiment of an input text. + * */ +public class AnalyzeSentimentAsync { + /** + * Main method to invoke this demo about how to analyze the sentiment of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "The hotel was dark and unclean."; + + client.analyzeSentiment(text).subscribe( + result -> { + final TextSentiment documentSentiment = result.getDocumentSentiment(); + System.out.printf( + "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", + documentSentiment.getTextSentimentClass(), + documentSentiment.getPositiveScore(), + documentSentiment.getNeutralScore(), + documentSentiment.getNegativeScore()); + + for (TextSentiment textSentiment : result.getSentenceSentiments()) { + System.out.printf( + "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", + textSentiment.getTextSentimentClass(), + textSentiment.getPositiveScore(), + textSentiment.getNeutralScore(), + textSentiment.getNegativeScore()); + } + }, + error -> System.err.println("There was an error analyzing sentiment of the text." + error), + () -> System.out.println("Sentiment analyzed.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguage.java new file mode 100644 index 000000000000..32eddc8f19e0 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguage.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; + +/** + * Sample demonstrates how to detect the language of an input text. + */ +public class DetectLanguage { + /** + * Main method to invoke this demo about how to detect the language of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "hello world"; + + final DetectLanguageResult detectLanguageResult = client.detectLanguage(text, "US"); + final DetectedLanguage detectedPrimaryLanguage = detectLanguageResult.getPrimaryLanguage(); + System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n", + detectedPrimaryLanguage.getName(), + detectedPrimaryLanguage.getIso6391Name(), + detectedPrimaryLanguage.getScore()); + + for (DetectedLanguage detectedLanguage : detectLanguageResult.getDetectedLanguages()) { + System.out.printf("Another detected language: %s, ISO 6391 name: %s, score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguageAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguageAsync.java new file mode 100644 index 000000000000..a1dc376928d1 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/DetectLanguageAsync.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectedLanguage; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously detect the language of an input text. + */ +public class DetectLanguageAsync { + /** + * Main method to invoke this demo about how to detect the language of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "hello world"; + + client.detectLanguage(text).subscribe( + result -> { + final DetectedLanguage primaryLanguage = result.getPrimaryLanguage(); + System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n", + primaryLanguage.getName(), primaryLanguage.getIso6391Name(), primaryLanguage.getScore()); + for (DetectedLanguage detectedLanguage : result.getDetectedLanguages()) { + System.out.printf("Another detected language: %s, ISO 6391 name: %s, score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + }, + error -> System.err.println("There was an error detecting language of the text." + error), + () -> System.out.println("Language detected.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrases.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrases.java new file mode 100644 index 000000000000..23d752ac72ee --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrases.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +/** + * Sample demonstrates how to extract the key phrases of an input text. + */ +public class ExtractKeyPhrases { + /** + * Main method to invoke this demo about how to extract the key phrases of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "My cat might need to see a veterinarian."; + + for (String keyPhrase : client.extractKeyPhrases(text).getKeyPhrases()) { + System.out.printf("Recognized phrases: %s.%n", keyPhrase); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrasesAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrasesAsync.java new file mode 100644 index 000000000000..8049c2bf4c6c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ExtractKeyPhrasesAsync.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously extract the key phrases of an input text. + */ +public class ExtractKeyPhrasesAsync { + /** + * Main method to invoke this demo about how to extract the key phrases of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "My cat might need to see a veterinarian."; + + client.extractKeyPhrases(text).subscribe( + result -> { + for (String keyPhrase : result.getKeyPhrases()) { + System.out.printf("Recognized phrases: %s.%n", keyPhrase); + } + }, + error -> System.err.println("There was an error extracting key phrases of the text." + error), + () -> System.out.println("Key phrases extracted.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorld.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorld.java new file mode 100644 index 000000000000..494f72b72f63 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorld.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; + +/** + * Sample demonstrates how to detect the language of an input text. + */ +public class HelloWorld { + /** + * Main method to invoke this demo about how to detect the language of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "hello world"; + + final DetectLanguageResult detectLanguageResult = client.detectLanguage(text, "US"); + final DetectedLanguage detectedPrimaryLanguage = detectLanguageResult.getPrimaryLanguage(); + System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n", + detectedPrimaryLanguage.getName(), + detectedPrimaryLanguage.getIso6391Name(), + detectedPrimaryLanguage.getScore()); + + for (DetectedLanguage detectedLanguage : detectLanguageResult.getDetectedLanguages()) { + System.out.printf("Another detected language: %s, ISO 6391 name: %s, score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorldAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorldAsync.java new file mode 100644 index 000000000000..d53fb874279e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/HelloWorldAsync.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectedLanguage; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously detect the language of an input text. + */ +public class HelloWorldAsync { + /** + * Main method to invoke this demo about how to detect the language of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "hello world"; + + client.detectLanguage(text).subscribe( + result -> { + final DetectedLanguage primaryLanguage = result.getPrimaryLanguage(); + System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n", + primaryLanguage.getName(), primaryLanguage.getIso6391Name(), primaryLanguage.getScore()); + for (DetectedLanguage detectedLanguage : result.getDetectedLanguages()) { + System.out.printf("Another detected language: %s, ISO 6391 name: %s, score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + }, + error -> System.err.println("There was an error detecting language of the text." + error), + () -> System.out.println("Language detected.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java new file mode 100644 index 000000000000..d78116526e29 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.TextSentiment; +import com.azure.core.http.HttpClient; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +/** + * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS ARE USED TO EXTRACT + * APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING LINE NUMBERS OF EXISTING CODE + * SAMPLES. + * + * Class containing code snippets that will be injected to README.md. + */ +public class ReadmeSamples { + private static final String SUBSCRIPTION_KEY = null; + private static final String ENDPOINT = null; + + /** + * Code snippet for getting sync client using subscription key authentication. + */ + public void useSubscriptionKeySyncClient() { + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + } + + /** + * Code snippet for getting async client using subscription key authentication. + */ + public void useSubscriptionKeyAsyncClient() { + TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildAsyncClient(); + } + + /** + * Code snippet for getting async client using AAD authentication. + */ + public void useAadAsyncClient() { + TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .endpoint(ENDPOINT) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + } + + /** + * Code snippet for detecting language in a text. + */ + public void detectLanguages() { + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + + String inputText = "Bonjour tout le monde"; + + for (DetectedLanguage detectedLanguage : textAnalyticsClient.detectLanguage(inputText).getDetectedLanguages()) { + System.out.printf("Detected languages name: %s, ISO 6391 Name: %s, Score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + } + + /** + * Code snippet for recognizing named entity in a text. + */ + public void recognizeNamedEntity() { + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + + String text = "Satya Nadella is the CEO of Microsoft"; + + for (NamedEntity entity : textAnalyticsClient.recognizeEntities(text).getNamedEntities()) { + System.out.printf( + "Recognized Named Entity: %s, Type: %s, Subtype: %s, Score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype(), + entity.getScore()); + } + } + + /** + * Code snippet for recognizing pii entity in a text. + */ + public void recognizePiiEntity() { + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + + // The text that need be analysed. + String text = "My SSN is 555-55-5555"; + + for (NamedEntity entity : textAnalyticsClient.recognizePiiEntities(text).getNamedEntities()) { + System.out.printf( + "Recognized PII Entity: %s, Type: %s, Subtype: %s, Score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype(), + entity.getScore()); + } + } + + /** + * Code snippet for recognizing linked entity in a text. + */ + public void recognizeLinkedEntity() { + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + + // The text that need be analysed. + String text = "Old Faithful is a geyser at Yellowstone Park."; + + for (LinkedEntity linkedEntity : textAnalyticsClient.recognizeLinkedEntities(text).getLinkedEntities()) { + System.out.printf("Recognized Linked Entity: %s, Url: %s, Data Source: %s.%n", + linkedEntity.getName(), + linkedEntity.getUrl(), + linkedEntity.getDataSource()); + } + } + + /** + * Code snippet for analyzing sentiment of a text. + */ + public void analyzeSentiment() { + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + + String text = "The hotel was dark and unclean."; + + for (TextSentiment textSentiment : textAnalyticsClient.analyzeSentiment(text).getSentenceSentiments()) { + System.out.printf( + "Analyzed Sentence Sentiment class: %s.%n", + textSentiment.getTextSentimentClass()); + } + } + + /** + * Code snippet for configuring http client. + */ + public void configureHttpClient() { + HttpClient client = new NettyAsyncHttpClientBuilder() + .port(8080) + .wiretap(true) + .build(); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntities.java new file mode 100644 index 000000000000..f0d940a35680 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntities.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.NamedEntity; + +/** + * Sample demonstrates how to recognize the entities of an input text. + */ +public class RecognizeEntities { + /** + * Main method to invoke this demo about how to recognize the entities of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "Satya Nadella is the CEO of Microsoft"; + + for (NamedEntity entity : client.recognizeEntities(text).getNamedEntities()) { + System.out.printf( + "Recognized entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntitiesAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntitiesAsync.java new file mode 100644 index 000000000000..9e831c43611c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeEntitiesAsync.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.NamedEntity; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously recognize the entities of an input text. + */ +public class RecognizeEntitiesAsync { + /** + * Main method to invoke this demo about how to recognize the entities of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "Satya Nadella is the CEO of Microsoft"; + + client.recognizeEntities(text).subscribe( + result -> { + for (NamedEntity entity : result.getNamedEntities()) { + System.out.printf( + "Recognized entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + }, + error -> System.err.println("There was an error recognizing entities of the text." + error), + () -> System.out.println("Entities recognized.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java new file mode 100644 index 000000000000..9e01255b55ae --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntities.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.LinkedEntity; + +/** + * Sample demonstrates how to recognize the linked entities of an input text. + */ +public class RecognizeLinkedEntities { + /** + * Main method to invoke this demo about how to recognize the linked entities of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "Old Faithful is a geyser at Yellowstone Park."; + + for (LinkedEntity linkedEntity : client.recognizeLinkedEntities(text).getLinkedEntities()) { + System.out.printf("Recognized linked entity: %s, URL: %s, data source: %s.%n", + linkedEntity.getName(), + linkedEntity.getUrl(), + linkedEntity.getDataSource()); + } + } + +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java new file mode 100644 index 000000000000..c10c3b800f83 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizeLinkedEntitiesAsync.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.LinkedEntity; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously recognize the linked entities of an input text. + */ +public class RecognizeLinkedEntitiesAsync { + /** + * Main method to invoke this demo about how to recognize the linked entities of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "Old Faithful is a geyser at Yellowstone Park."; + + client.recognizeLinkedEntities(text).subscribe( + result -> { + for (LinkedEntity linkedEntity : result.getLinkedEntities()) { + System.out.printf("Recognized linked entity: %s, URL: %s, data source: %s.%n", + linkedEntity.getName(), + linkedEntity.getUrl(), + linkedEntity.getDataSource()); + } + }, + error -> System.err.println("There was an error recognizing linked entity of the text." + error), + () -> System.out.println("Linked entity recognized.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePii.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePii.java new file mode 100644 index 000000000000..71cc78bd856f --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePii.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.NamedEntity; + +/** + * Sample demonstrates how to recognize the PII(Personally Identifiable Information) entities of an input text. + */ +public class RecognizePii { + /** + * Main method to invoke this demo about how to recognize the PII entities of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The text that need be analysed. + String text = "My SSN is 555-55-5555"; + + for (NamedEntity entity : client.recognizePiiEntities(text).getNamedEntities()) { + System.out.printf( + "Recognized personal identifiable information entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java new file mode 100644 index 000000000000..3186b57f3cf9 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.NamedEntity; + +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously recognize the PII(Personally Identifiable Information) entities of an input + * text. + */ +public class RecognizePiiAsync { + /** + * Main method to invoke this demo about how to recognize the PII entities of an input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The text that need be analysed. + String text = "My SSN is 555-55-5555"; + + client.recognizePiiEntities(text).subscribe( + result -> { + for (NamedEntity entity : result.getNamedEntities()) { + System.out.printf( + "Recognized personal identifiable information entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + }, + error -> System.err.println("There was an error recognizing PII entities of the text." + error), + () -> System.out.println("PII entities recognized.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..9be79bf295fc --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +/** + * Code snippet for {@link TextAnalyticsAsyncClient} + */ +public class TextAnalyticsAsyncClientJavaDocCodeSnippets { + private static final String SUBSCRIPTION_KEY = null; + private static final String ENDPOINT = null; + + /** + * Code snippet for creating a {@link TextAnalyticsAsyncClient} + * + * @return The TextAnalyticsAsyncClient object + */ + public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient() { + // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.instantiation + TextAnalyticsAsyncClient textAnalyticsAsyncClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildAsyncClient(); + // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.instantiation + return textAnalyticsAsyncClient; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..268575bc9349 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +/** + * Code snippet for {@link TextAnalyticsClient} + */ +public class TextAnalyticsClientJavaDocCodeSnippets { + private static final String SUBSCRIPTION_KEY = null; + private static final String ENDPOINT = null; + + /** + * Code snippet for creating a {@link TextAnalyticsClient} + * + * @return The TextAnalyticsClient object. + */ + public TextAnalyticsClient createTextAnalyticsClient() { + // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.instantiation + TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder() + .subscriptionKey(SUBSCRIPTION_KEY) + .endpoint(ENDPOINT) + .buildClient(); + // END: com.azure.ai.textanalytics.TextAnalyticsClient.instantiation + return textAnalyticsClient; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java new file mode 100644 index 000000000000..80a1b5fbbe61 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocuments.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.models.TextSentiment; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; +import com.azure.core.util.Context; + +import java.util.Arrays; +import java.util.List; + +/** + * Sample demonstrates how to analyze the sentiments of a batch input text. + */ +public class AnalyzeSentimentBatchDocuments { + /** + * Main method to invoke this demo about how to analyze the sentiments of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.", "en"), + new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Analyzing batch sentiments + DocumentResultCollection analyzedBatchResult = client.analyzeBatchSentimentWithResponse( + inputs, requestOptions, Context.NONE).getValue(); + System.out.printf("Model version: %s%n", analyzedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = analyzedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Analyzed sentiment for each of document from a batch of documents + for (AnalyzeSentimentResult analyzeSentimentResult : analyzedBatchResult) { + System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); + // Erroneous document + if (analyzeSentimentResult.isError()) { + System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage()); + continue; + } + // Valid document + final TextSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); + System.out.printf("Recognized document sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n", + documentSentiment.getTextSentimentClass(), + documentSentiment.getPositiveScore(), + documentSentiment.getNeutralScore(), + documentSentiment.getNegativeScore(), + documentSentiment.getLength(), + documentSentiment.getOffset()); + for (TextSentiment sentenceSentiment : analyzeSentimentResult.getSentenceSentiments()) { + System.out.printf("Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n", + sentenceSentiment.getTextSentimentClass(), + sentenceSentiment.getPositiveScore(), + sentenceSentiment.getNeutralScore(), + sentenceSentiment.getNegativeScore(), + sentenceSentiment.getLength(), + sentenceSentiment.getOffset()); + } + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsAsync.java new file mode 100644 index 000000000000..cc7b8983c432 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsAsync.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.models.TextSentiment; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously analyze the sentiments of a batch input text. + */ +public class AnalyzeSentimentBatchDocumentsAsync { + /** + * Main method to invoke this demo about how to analyze the sentiments of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.", "en"), + new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Analyzing batch sentiments + client.analyzeBatchSentimentWithResponse(inputs, requestOptions).subscribe( + result -> { + DocumentResultCollection analyzedBatchResult = result.getValue(); + System.out.printf("Model version: %s%n", analyzedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = analyzedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Analyzed sentiment for each of document from a batch of documents + for (AnalyzeSentimentResult analyzeSentimentResult : analyzedBatchResult) { + System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); + // Erroneous document + if (analyzeSentimentResult.isError()) { + System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage()); + continue; + } + // Valid document + final TextSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); + System.out.printf("Analyzed document sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n", + documentSentiment.getTextSentimentClass(), + documentSentiment.getPositiveScore(), + documentSentiment.getNeutralScore(), + documentSentiment.getNegativeScore(), + documentSentiment.getLength(), + documentSentiment.getOffset()); + for (TextSentiment sentenceSentiment : analyzeSentimentResult.getSentenceSentiments()) { + System.out.printf("Analyzed sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n", + sentenceSentiment.getTextSentimentClass(), + sentenceSentiment.getPositiveScore(), + sentenceSentiment.getNeutralScore(), + sentenceSentiment.getNegativeScore(), + sentenceSentiment.getLength(), + sentenceSentiment.getOffset()); + } + } + }, + error -> System.err.println("There was an error analyzing sentiment of the text inputs." + error), + () -> System.out.println("Batch of sentiment analyzed.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java new file mode 100644 index 000000000000..a33ce2f8ea6b --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocuments.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.core.util.Context; + +import java.util.Arrays; +import java.util.List; + +/** + * Sample demonstrates how to detect the languages of a batch input text. + */ +public class DetectLanguageBatchDocuments { + /** + * Main method to invoke this demo about how to detect the languages of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new DetectLanguageInput("1", "This is written in English.", "us"), + new DetectLanguageInput("2", "Este es un document escrito en Español.", "es") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Detecting batch languages + final DocumentResultCollection detectedBatchResult = + client.detectBatchLanguagesWithResponse(inputs, requestOptions, Context.NONE).getValue(); + System.out.printf("Model version: %s%n", detectedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = detectedBatchResult.getStatistics(); + System.out.printf("Batch statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Detected languages for a document from a batch of documents + for (DetectLanguageResult detectLanguageResult : detectedBatchResult) { + System.out.printf("Document ID: %s%n", detectLanguageResult.getId()); + // Erroneous document + if (detectLanguageResult.isError()) { + System.out.printf("Cannot detect language. Error: %s%n", detectLanguageResult.getError().getMessage()); + continue; + } + // Valid document + final DetectedLanguage detectedPrimaryLanguage = detectLanguageResult.getPrimaryLanguage(); + System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n", + detectedPrimaryLanguage.getName(), + detectedPrimaryLanguage.getIso6391Name(), + detectedPrimaryLanguage.getScore()); + for (DetectedLanguage detectedLanguage : detectLanguageResult.getDetectedLanguages()) { + System.out.printf("Another detected language: %s, ISO 6391 name: %s, score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocumentsAsync.java new file mode 100644 index 000000000000..e52f2b859489 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/DetectLanguageBatchDocumentsAsync.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously detect the languages of a batch input text. + */ +public class DetectLanguageBatchDocumentsAsync { + /** + * Main method to invoke this demo about how to detect the languages of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new DetectLanguageInput("1", "This is written in English.", "us"), + new DetectLanguageInput("2", "Este es un document escrito en Español.", "es") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Detecting batch languages + client.detectBatchLanguagesWithResponse(inputs, requestOptions).subscribe( + result -> { + final DocumentResultCollection detectedBatchResult = result.getValue(); + System.out.printf("Model version: %s%n", detectedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = detectedBatchResult.getStatistics(); + System.out.printf("Batch statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Detected languages for a document from a batch of documents + for (DetectLanguageResult detectLanguageResult : detectedBatchResult) { + System.out.printf("Document ID: %s%n", detectLanguageResult.getId()); + // Erroneous document + if (detectLanguageResult.isError()) { + System.out.printf("Cannot detect language. Error: %s%n", detectLanguageResult.getError().getMessage()); + continue; + } + // Valid document + final DetectedLanguage detectedPrimaryLanguage = detectLanguageResult.getPrimaryLanguage(); + System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n", + detectedPrimaryLanguage.getName(), + detectedPrimaryLanguage.getIso6391Name(), + detectedPrimaryLanguage.getScore()); + for (DetectedLanguage detectedLanguage : detectLanguageResult.getDetectedLanguages()) { + System.out.printf("Another detected language: %s, ISO 6391 name: %s, score: %s.%n", + detectedLanguage.getName(), + detectedLanguage.getIso6391Name(), + detectedLanguage.getScore()); + } + } + }, + error -> System.err.println("There was an error detecting language of the text inputs." + error), + () -> System.out.println("Batch of language detected.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocuments.java new file mode 100644 index 000000000000..8af363673984 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocuments.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.core.util.Context; + +import java.util.Arrays; +import java.util.List; + +/** + * Sample demonstrates how to extract the key phrases of a batch input text. + */ +public class ExtractKeyPhrasesBatchDocuments { + /** + * Main method to invoke this demo about how to extract the key phrases of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "My cat might need to see a veterinarian.", "en"), + new TextDocumentInput("2", "The pitot tube is used to measure airspeed.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Extracting batch key phrases + final DocumentResultCollection extractedBatchResult = client.extractBatchKeyPhrasesWithResponse(inputs, requestOptions, Context.NONE).getValue(); + System.out.printf("Model version: %s%n", extractedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = extractedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Extracted key phrase for each of document from a batch of documents + for (ExtractKeyPhraseResult extractKeyPhraseResult : extractedBatchResult) { + System.out.printf("Document ID: %s%n", extractKeyPhraseResult.getId()); + // Erroneous document + if (extractKeyPhraseResult.isError()) { + System.out.printf("Cannot extract key phrases. Error: %s%n", extractKeyPhraseResult.getError().getMessage()); + continue; + } + // Valid document + for (String keyPhrases : extractKeyPhraseResult.getKeyPhrases()) { + System.out.printf("Extracted phrases: %s.%n", keyPhrases); + } + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocumentsAsync.java new file mode 100644 index 000000000000..4991b96c8cd4 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/ExtractKeyPhrasesBatchDocumentsAsync.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously extract the key phrases of a batch input text. + */ +public class ExtractKeyPhrasesBatchDocumentsAsync { + /** + * Main method to invoke this demo about how to extract the key phrases of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "My cat might need to see a veterinarian.", "en"), + new TextDocumentInput("2", "The pitot tube is used to measure airspeed.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Extracting batch key phrases + client.extractBatchKeyPhrasesWithResponse(inputs, requestOptions).subscribe( + result -> { + final DocumentResultCollection extractedBatchResult = result.getValue(); + System.out.printf("Model version: %s%n", extractedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = extractedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Extracted key phrase for each of document from a batch of documents + for (ExtractKeyPhraseResult extractKeyPhraseResult : extractedBatchResult) { + System.out.printf("Document ID: %s%n", extractKeyPhraseResult.getId()); + // Erroneous document + if (extractKeyPhraseResult.isError()) { + System.out.printf("Cannot extract key phrases. Error: %s%n", extractKeyPhraseResult.getError().getMessage()); + continue; + } + // Valid document + for (String keyPhrases : extractKeyPhraseResult.getKeyPhrases()) { + System.out.printf("Extracted phrases: %s.%n", keyPhrases); + } + } + }, + error -> System.err.println("There was an error extracting key phrases of the text inputs." + error), + () -> System.out.println("Batch of key phrases extracted.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java new file mode 100644 index 000000000000..25c396359524 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocuments.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.core.util.Context; + +import java.util.Arrays; +import java.util.List; + +/** + * Sample demonstrates how to recognize the entities of a batch input text. + */ +public class RecognizeEntitiesBatchDocuments { + /** + * Main method to invoke this demo about how to recognize the entities of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "Satya Nadella is the CEO of Microsoft.", "en"), + new TextDocumentInput("2", "Elon Musk is the CEO of SpaceX and Tesla.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Recognizing batch entities + final DocumentResultCollection recognizedBatchResult = + client.recognizeBatchEntitiesWithResponse(inputs, requestOptions, Context.NONE).getValue(); + System.out.printf("Model version: %s%n", recognizedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = recognizedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Recognized entities for each of document from a batch of documents + for (RecognizeEntitiesResult recognizeEntitiesResult : recognizedBatchResult) { + System.out.printf("Document ID: %s%n", recognizeEntitiesResult.getId()); + // Erroneous document + if (recognizeEntitiesResult.isError()) { + System.out.printf("Cannot recognize entities. Error: %s%n", recognizeEntitiesResult.getError().getMessage()); + continue; + } + // Valid document + for (NamedEntity entity : recognizeEntitiesResult.getNamedEntities()) { + System.out.printf("Recognized entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocumentsAsync.java new file mode 100644 index 000000000000..3a39d1a21314 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeEntitiesBatchDocumentsAsync.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously recognize the entities of a batch input text. + */ +public class RecognizeEntitiesBatchDocumentsAsync { + /** + * Main method to invoke this demo about how to recognize the entities of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "Satya Nadella is the CEO of Microsoft.", "en"), + new TextDocumentInput("2", "Elon Musk is the CEO of SpaceX and Tesla.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Recognizing batch entities + client.recognizeBatchEntitiesWithResponse(inputs, requestOptions).subscribe( + result -> { + final DocumentResultCollection recognizedBatchResult = result.getValue(); + System.out.printf("Model version: %s%n", recognizedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = recognizedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Recognized entities for each of document from a batch of documents + for (RecognizeEntitiesResult recognizeEntitiesResult : recognizedBatchResult) { + System.out.printf("Document ID: %s%n", recognizeEntitiesResult.getId()); + // Erroneous document + if (recognizeEntitiesResult.isError()) { + System.out.printf("Cannot recognize entities. Error: %s%n", recognizeEntitiesResult.getError().getMessage()); + continue; + } + // Valid document + for (NamedEntity entity : recognizeEntitiesResult.getNamedEntities()) { + System.out.printf("Recognized entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + } + }, + error -> System.err.println("There was an error recognizing entities of the text inputs." + error), + () -> System.out.println("Batch of entities recognized.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java new file mode 100644 index 000000000000..bc85a0b36a8e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocuments.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.core.util.Context; + +import java.util.Arrays; +import java.util.List; + +/** + * Sample demonstrates how to recognize the linked entities of a batch input text. + */ +public class RecognizeLinkedEntitiesBatchDocuments { + /** + * Main method to invoke this demo about how to recognize the linked entities of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "Old Faithful is a geyser at Yellowstone Park.", "en"), + new TextDocumentInput("2", "Mount Shasta has lenticular clouds.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Recognizing batch entities + final DocumentResultCollection recognizedBatchResult = client.recognizeBatchLinkedEntitiesWithResponse(inputs, requestOptions, Context.NONE).getValue(); + System.out.printf("Model version: %s%n", recognizedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = recognizedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Recognized linked entities from a batch of documents + for (RecognizeLinkedEntitiesResult linkedEntityDocumentResult : recognizedBatchResult) { + System.out.printf("Document ID: %s%n", linkedEntityDocumentResult.getId()); + // Erroneous document + if (linkedEntityDocumentResult.isError()) { + System.out.printf("Cannot recognize linked entities. Error: %s%n", linkedEntityDocumentResult.getError().getMessage()); + continue; + } + // Valid document + for (LinkedEntity linkedEntity : linkedEntityDocumentResult.getLinkedEntities()) { + System.out.printf("Recognized linked entity: %s, URL: %s, data source: %s%n", + linkedEntity.getName(), + linkedEntity.getUrl(), + linkedEntity.getDataSource()); + } + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java new file mode 100644 index 000000000000..4b6038a093cf --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizeLinkedEntitiesBatchDocumentsAsync.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously recognize the linked entities of a batch input text. + */ +public class RecognizeLinkedEntitiesBatchDocumentsAsync { + /** + * Main method to invoke this demo about how to recognize the linked entities of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "Old Faithful is a geyser at Yellowstone Park.", "en"), + new TextDocumentInput("2", "Mount Shasta has lenticular clouds.", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Recognizing batch entities + client.recognizeBatchLinkedEntitiesWithResponse(inputs, requestOptions).subscribe( + result -> { + final DocumentResultCollection recognizedBatchResult = result.getValue(); + System.out.printf("Model version: %s%n", recognizedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = recognizedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Recognized linked entities from a batch of documents + for (RecognizeLinkedEntitiesResult linkedEntityDocumentResult : recognizedBatchResult) { + System.out.printf("Document ID: %s%n", linkedEntityDocumentResult.getId()); + // Erroneous document + if (linkedEntityDocumentResult.isError()) { + System.out.printf("Cannot recognize linked entities. Error: %s%n", linkedEntityDocumentResult.getError().getMessage()); + continue; + } + // Valid document + for (LinkedEntity linkedEntity : linkedEntityDocumentResult.getLinkedEntities()) { + System.out.printf("Recognized linked entities: %s, URL: %s, data source: %s%n", + linkedEntity.getName(), + linkedEntity.getUrl(), + linkedEntity.getDataSource()); + } + } + }, + error -> System.err.println("There was an error recognizing linked entities of the text inputs." + error), + () -> System.out.println("Batch of linked entities recognized.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocuments.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocuments.java new file mode 100644 index 000000000000..edf4b38b63f4 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocuments.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.core.util.Context; + +import java.util.Arrays; +import java.util.List; + +/** + * Sample demonstrates how to recognize the PII(Personally Identifiable Information) entities of a batch input text. + */ +public class RecognizePiiBatchDocuments { + /** + * Main method to invoke this demo about how to recognize the PII entities of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "My SSN is 555-55-5555", "en"), + new TextDocumentInput("2", "Visa card 4111 1111 1111 1111", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Recognizing batch entities + final DocumentResultCollection recognizedBatchResult = + client.recognizeBatchPiiEntitiesWithResponse(inputs, requestOptions, Context.NONE).getValue(); + System.out.printf("Model version: %s%n", recognizedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = recognizedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Recognized PII entities for each of document from a batch of documents + for (RecognizePiiEntitiesResult piiEntityDocumentResult : recognizedBatchResult) { + System.out.printf("Document ID: %s%n", piiEntityDocumentResult.getId()); + // Erroneous document + if (piiEntityDocumentResult.isError()) { + System.out.printf("Cannot recognize PII entities. Error: %s%n", piiEntityDocumentResult.getError().getMessage()); + continue; + } + // Valid document + for (NamedEntity entity : piiEntityDocumentResult.getNamedEntities()) { + System.out.printf("Recognized personal identifiable information entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocumentsAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocumentsAsync.java new file mode 100644 index 000000000000..e38983e2e7d6 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiBatchDocumentsAsync.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.batch; + +import com.azure.ai.textanalytics.TextAnalyticsAsyncClient; +import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Sample demonstrates how to asynchronously recognize the PII(Personally Identifiable Information) entities of a batch + * input text. + */ +public class RecognizePiiBatchDocumentsAsync { + /** + * Main method to invoke this demo about how to recognize the PII entities of a batch input text. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + // Instantiate a client that will be used to call the service. + TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() + .subscriptionKey("{subscription_key}") + .endpoint("https://{servicename}.cognitiveservices.azure.com/") + .buildAsyncClient(); + + // The texts that need be analysed. + List inputs = Arrays.asList( + new TextDocumentInput("1", "My SSN is 555-55-5555", "en"), + new TextDocumentInput("2", "Visa card 4111 1111 1111 1111", "en") + ); + + // Request options: show statistics and model version + final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true); + + // Recognizing batch entities + client.recognizeBatchPiiEntitiesWithResponse(inputs, requestOptions).subscribe( + result -> { + final DocumentResultCollection recognizedBatchResult = result.getValue(); + System.out.printf("Model version: %s%n", recognizedBatchResult.getModelVersion()); + + // Batch statistics + final TextDocumentBatchStatistics batchStatistics = recognizedBatchResult.getStatistics(); + System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n", + batchStatistics.getDocumentCount(), + batchStatistics.getErroneousDocumentCount(), + batchStatistics.getTransactionCount(), + batchStatistics.getValidDocumentCount()); + + // Recognized PII entities for each of document from a batch of documents + for (RecognizePiiEntitiesResult piiEntityDocumentResult : recognizedBatchResult) { + System.out.printf("Document ID: %s%n", piiEntityDocumentResult.getId()); + // Erroneous document + if (piiEntityDocumentResult.isError()) { + System.out.printf("Cannot recognize PII entities. Error: %s%n", piiEntityDocumentResult.getError().getMessage()); + continue; + } + // Valid document + for (NamedEntity entity : piiEntityDocumentResult.getNamedEntities()) { + System.out.printf("Recognized personal identifiable information entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", + entity.getText(), + entity.getType(), + entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), + entity.getOffset(), + entity.getLength(), + entity.getScore()); + } + } + }, + error -> System.err.println("There was an error recognizing PII entities of the text inputs." + error), + () -> System.out.println("Batch of PII entities recognized.")); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + try { + TimeUnit.SECONDS.sleep(5); + } catch (InterruptedException ignored) { + } + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java new file mode 100644 index 000000000000..326293aa5fbe --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.ErrorCodeValue; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.LinkedEntityMatch; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsError; +import com.azure.ai.textanalytics.models.TextSentiment; +import com.azure.ai.textanalytics.models.TextSentimentClass; +import com.azure.core.exception.HttpResponseException; +import org.junit.jupiter.api.Test; +import reactor.test.StepVerifier; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { + private TextAnalyticsAsyncClient client; + + @Override + protected void beforeTest() { + client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() + .endpoint(getEndpoint()) + .pipeline(httpPipeline) + .buildAsyncClient()); + } + + // Detected Languages + /** + * Verify that we can get statistics on the collection result when given a batch input with options. + */ + @Test + public void detectLanguagesBatchInputShowStatistics() { + detectLanguageShowStatisticsRunner((inputs, options) -> { + StepVerifier.create(client.detectBatchLanguagesWithResponse(inputs, options)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)) + .verifyComplete(); + }); + } + + /** + * Test Detect batch input languages. + */ + @Test + public void detectLanguagesBatchInput() { + detectLanguageRunner((inputs) -> { + StepVerifier.create(client.detectBatchLanguages(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)) + .verifyComplete(); + }); + } + + /** + * Test Detect batch languages for List of String input with country Hint. + */ + @Test + public void detectLanguagesBatchListCountryHint() { + detectLanguagesCountryHintRunner((inputs, countryHint) -> { + StepVerifier.create(client.detectLanguagesWithResponse(inputs, countryHint)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)) + .verifyComplete(); + }); + } + + /** + * Test Detect batch languages for List of String input. + */ + @Test + public void detectLanguagesBatchStringInput() { + detectLanguageStringInputRunner((inputs) -> { + StepVerifier.create(client.detectLanguages(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)) + .verifyComplete(); + }); + } + + /** + * Verifies that a single DetectLanguageResult is returned for a text input to detectLanguages. + */ + @Test + public void detectSingleTextLanguage() { + DetectedLanguage primaryLanguage = new DetectedLanguage("English", "en", 1.0); + List expectedLanguageList = Arrays.asList(primaryLanguage); + StepVerifier.create(client.detectLanguage("This is a test English Text")) + .assertNext(response -> validateDetectedLanguages(expectedLanguageList, response.getDetectedLanguages())) + .verifyComplete(); + } + + /** + * Verifies that an error document is returned for a text input with invalid country hint. + *

+ * TODO: update error Model. #6559 + */ + @Test + public void detectLanguageInvalidCountryHint() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid Country Hint.", null, null); + StepVerifier.create(client.detectLanguageWithResponse("Este es un document escrito en Español.", "en")) + .assertNext(response -> validateErrorDocument(expectedError, response.getValue().getError())) + .verifyComplete(); + } + + /** + * Verifies that an error document is returned for a empty text input. + */ + @Test + public void detectLanguageEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + StepVerifier.create(client.detectLanguage("")) + .assertNext(response -> validateErrorDocument(expectedError, response.getError())) + .verifyComplete(); + } + + /** + * Verifies that detectLanguage returns an "UNKNOWN" result when faulty text is passed. + */ + @Test + public void detectLanguageFaultyText() { + StepVerifier.create(client.detectLanguage("!@#%%")) + .assertNext(response -> assertEquals(response.getPrimaryLanguage().getIso6391Name(), "(Unknown)")) + .verifyComplete(); + } + + /** + * Verifies that a Bad request exception is returned for input documents with same ids. + */ + @Test + public void detectLanguageDuplicateIdInput() { + detectLanguageDuplicateIdRunner((inputs, options) -> { + StepVerifier.create(client.detectBatchLanguagesWithResponse(inputs, options)) + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseException.class, 400)); + }); + } + + // Entities + @Test + public void recognizeEntitiesForTextInput() { + NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); + NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); + RecognizeEntitiesResult recognizeEntitiesResultList = new RecognizeEntitiesResult("0", null, null, Arrays.asList(namedEntity1, namedEntity2)); + StepVerifier.create(client.recognizeEntities("I had a wonderful trip to Seattle last week.")) + .assertNext(response -> validateNamedEntities(recognizeEntitiesResultList.getNamedEntities(), response.getNamedEntities())) + .verifyComplete(); + } + + @Test + public void recognizeEntitiesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + StepVerifier.create(client.recognizeEntities("")) + .assertNext(response -> validateErrorDocument(expectedError, response.getError())) + .verifyComplete(); + } + + @Test + public void recognizeEntitiesForFaultyText() { + // TODO: (savaity) confirm with service team this returns no error-ed document, no exception but empty documents and error list. + StepVerifier.create(client.recognizeEntities("!@#%%")) + .assertNext(response -> assertEquals(response.getNamedEntities().size(), 0)) + .verifyComplete(); + } + + @Test + public void recognizeEntitiesForBatchInput() { + recognizeBatchNamedEntityRunner((inputs) -> { + StepVerifier.create(client.recognizeBatchEntities(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizeEntitiesForBatchInputShowStatistics() { + recognizeBatchNamedEntitiesShowStatsRunner((inputs, options) -> { + StepVerifier.create(client.recognizeBatchEntitiesWithResponse(inputs, options)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizeEntitiesForBatchStringInput() { + recognizeNamedEntityStringInputRunner((inputs) -> { + StepVerifier.create(client.recognizeEntities(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizeEntitiesForListLanguageHint() { + recognizeNamedEntitiesLanguageHintRunner((inputs, language) -> { + StepVerifier.create(client.recognizeEntitiesWithResponse(inputs, language)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + // Linked Entities + @Test + public void recognizeLinkedEntitiesForTextInput() { + LinkedEntityMatch linkedEntityMatch1 = new LinkedEntityMatch("Seattle", 0.11472424095537814, 7, 26); + LinkedEntity linkedEntity1 = new LinkedEntity("Seattle", Collections.singletonList(linkedEntityMatch1), "en", "Seattle", "https://en.wikipedia.org/wiki/Seattle", "Wikipedia"); + RecognizeLinkedEntitiesResult recognizeLinkedEntitiesResultList = new RecognizeLinkedEntitiesResult("0", null, null, Collections.singletonList(linkedEntity1)); + + StepVerifier.create(client.recognizeLinkedEntities("I had a wonderful trip to Seattle last week.")) + .assertNext(response -> validateLinkedEntities(recognizeLinkedEntitiesResultList.getLinkedEntities(), response.getLinkedEntities())) + .verifyComplete(); + } + + @Test + public void recognizeLinkedEntitiesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + StepVerifier.create(client.recognizeLinkedEntities("")) + .assertNext(response -> validateErrorDocument(expectedError, response.getError())) + .verifyComplete(); + } + + @Test + public void recognizeLinkedEntitiesForFaultyText() { + StepVerifier.create(client.recognizeLinkedEntities("!@#%%")) + .assertNext(response -> assertEquals(response.getLinkedEntities().size(), 0)) + .verifyComplete(); + } + + @Test + public void recognizeLinkedEntitiesForBatchInput() { + recognizeBatchLinkedEntityRunner((inputs) -> { + StepVerifier.create(client.recognizeBatchLinkedEntities(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizeLinkedEntitiesForBatchInputShowStatistics() { + recognizeBatchLinkedEntitiesShowStatsRunner((inputs, options) -> { + StepVerifier.create(client.recognizeBatchLinkedEntitiesWithResponse(inputs, options)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizeLinkedEntitiesForBatchStringInput() { + recognizeLinkedStringInputRunner((inputs) -> { + StepVerifier.create(client.recognizeLinkedEntities(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizeLinkedEntitiesForListLanguageHint() { + recognizeLinkedLanguageHintRunner((inputs, language) -> { + StepVerifier.create(client.recognizeLinkedEntitiesWithResponse(inputs, language)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchLinkedEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + // Pii Entities + @Test + public void recognizePiiEntitiesForTextInput() { + NamedEntity namedEntity1 = new NamedEntity("859-98-0987", "U.S. Social Security Number (SSN)", "", 28, 11, 0.65); + RecognizeEntitiesResult recognizeEntitiesResultList = new RecognizeEntitiesResult("0", null, null, Collections.singletonList(namedEntity1)); + + StepVerifier.create(client.recognizePiiEntities("Microsoft employee with ssn 859-98-0987 is using our awesome API's.")) + .assertNext(response -> validateNamedEntities(recognizeEntitiesResultList.getNamedEntities(), response.getNamedEntities())) + .verifyComplete(); + } + + @Test + public void recognizePiiEntitiesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + StepVerifier.create(client.recognizePiiEntities("")) + .assertNext(response -> validateErrorDocument(expectedError, response.getError())) + .verifyComplete(); + } + + @Test + public void recognizePiiEntitiesForFaultyText() { + // TODO: (savaity) confirm with service team this returns no error-ed document, no exception but empty documents and error list. + StepVerifier.create(client.recognizePiiEntities("!@#%%")) + .assertNext(response -> assertEquals(response.getNamedEntities().size(), 0)) + .verifyComplete(); + } + + @Test + public void recognizePiiEntitiesForBatchInput() { + recognizeBatchPiiRunner((inputs) -> { + StepVerifier.create(client.recognizeBatchPiiEntities(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizePiiEntitiesForBatchInputShowStatistics() { + recognizeBatchPiiEntitiesShowStatsRunner((inputs, options) -> { + StepVerifier.create(client.recognizeBatchPiiEntitiesWithResponse(inputs, options)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizePiiEntitiesForBatchStringInput() { + recognizePiiStringInputRunner((inputs) -> { + StepVerifier.create(client.recognizePiiEntities(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + @Test + public void recognizePiiEntitiesForListLanguageHint() { + recognizePiiLanguageHintRunner((inputs, language) -> { + StepVerifier.create(client.recognizePiiEntitiesWithResponse(inputs, language)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)) + .verifyComplete(); + }); + } + + + // Key Phrases + @Test + public void extractKeyPhrasesForTextInput() { + List keyPhrasesList1 = Arrays.asList("monde"); + StepVerifier.create(client.extractKeyPhrasesWithResponse("Bonjour tout le monde.", "fr")) + .assertNext(response -> validateKeyPhrases(keyPhrasesList1, response.getValue().getKeyPhrases())) + .verifyComplete(); + } + + @Test + public void extractKeyPhrasesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + StepVerifier.create(client.extractKeyPhrases("")) + .assertNext(response -> validateErrorDocument(expectedError, response.getError())) + .verifyComplete(); + } + + @Test + public void extractKeyPhrasesForFaultyText() { + StepVerifier.create(client.extractKeyPhrases("!@#%%")) + .assertNext(response -> assertEquals(response.getKeyPhrases().size(), 0)) + .verifyComplete(); + } + + @Test + public void extractKeyPhrasesForBatchInput() { + extractBatchKeyPhrasesRunner((inputs) -> { + StepVerifier.create(client.extractBatchKeyPhrases(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)) + .verifyComplete(); + }); + + } + + @Test + public void extractKeyPhrasesForBatchInputShowStatistics() { + extractBatchKeyPhrasesShowStatsRunner((inputs, options) -> { + StepVerifier.create(client.extractBatchKeyPhrasesWithResponse(inputs, options)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)) + .verifyComplete(); + }); + } + + @Test + public void extractKeyPhrasesForBatchStringInput() { + extractKeyPhrasesStringInputRunner((inputs) -> { + StepVerifier.create(client.extractKeyPhrases(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)) + .verifyComplete(); + }); + } + + @Test + public void extractKeyPhrasesForListLanguageHint() { + extractKeyPhrasesLanguageHintRunner((inputs, language) -> { + StepVerifier.create(client.extractKeyPhrasesWithResponse(inputs, language)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)) + .verifyComplete(); + }); + } + + // Sentiment + /** + * Test analyzing sentiment for a string input. + */ + @Test + public void analyseSentimentForTextInput() { + final TextSentiment expectedDocumentSentiment = new TextSentiment(TextSentimentClass.MIXED, 0.1, 0.5, 0.4, 66, 0); + final List expectedSentenceSentiments = Arrays.asList( + new TextSentiment(TextSentimentClass.NEGATIVE, 0.99, 0.005, 0.005, 31, 0), + new TextSentiment(TextSentimentClass.POSITIVE, 0.005, 0.005, 0.99, 35, 32)); + + StepVerifier + .create(client.analyzeSentiment("The hotel was dark and unclean. The restaurant had amazing gnocchi.")) + .assertNext(response -> { + validateAnalysedSentiment(expectedDocumentSentiment, response.getDocumentSentiment()); + validateAnalysedSentenceSentiment(expectedSentenceSentiments, response.getSentenceSentiments()); + }).verifyComplete(); + } + + /** + * Verifies that an error document is returned for a empty text input. + */ + @Test + public void analyseSentimentForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + StepVerifier.create(client.analyzeSentiment("")) + .assertNext(response -> validateErrorDocument(expectedError, response.getError())).verifyComplete(); + } + + public void analyseSentimentForFaultyText() { + // TODO (shawn): add this case later + } + + /** + * Test analyzing sentiment for a list of string input. + */ + @Test + public void analyseSentimentForBatchStringInput() { + analyseSentimentStringInputRunner(inputs -> + StepVerifier.create(client.analyzeSentiment(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)) + .verifyComplete()); + } + + /** + * Test analyzing sentiment for a list of string input with language hint. + */ + @Test + public void analyseSentimentForListLanguageHint() { + analyseSentimentLanguageHintRunner((inputs, language) -> + StepVerifier.create(client.analyzeSentimentWithResponse(inputs, language)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)) + .verifyComplete()); + } + + /** + * Test analyzing sentiment for batch input. + */ + @Test + public void analyseSentimentForBatchInput() { + analyseBatchSentimentRunner(inputs -> + StepVerifier.create(client.analyzeBatchSentiment(inputs)) + .assertNext(response -> validateBatchResult(response, getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)) + .verifyComplete()); + } + + /** + * Verify that we can get statistics on the collection result when given a batch input with options. + */ + @Test + public void analyseSentimentForBatchInputShowStatistics() { + analyseBatchSentimentShowStatsRunner((inputs, options) -> + StepVerifier.create(client.analyzeBatchSentimentWithResponse(inputs, options)) + .assertNext(response -> validateBatchResult(response.getValue(), getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)) + .verifyComplete()); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java new file mode 100644 index 000000000000..0499abf09644 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.ErrorCodeValue; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.LinkedEntityMatch; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsError; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.util.Context; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { + + private TextAnalyticsClient client; + + @Override + protected void beforeTest() { + client = clientSetup(httpPipeline -> new TextAnalyticsClientBuilder() + .endpoint(getEndpoint()) + .pipeline(httpPipeline) + .buildClient()); + } + + /** + * Verify that we can get statistics on the collection result when given a batch input with options. + */ + @Test + public void detectLanguagesBatchInputShowStatistics() { + detectLanguageShowStatisticsRunner((inputs, options) -> validateBatchResult( + client.detectBatchLanguagesWithResponse(inputs, options, Context.NONE).getValue(), + getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)); + } + + /** + * Test Detect batch input languages. + */ + @Test + public void detectLanguagesBatchInput() { + detectLanguageRunner((inputs) -> validateBatchResult(client.detectBatchLanguages(inputs), + getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)); + } + + /** + * Test Detect batch languages for List of String input with country Hint. + */ + @Test + public void detectLanguagesBatchListCountryHint() { + detectLanguagesCountryHintRunner((inputs, countryHint) -> validateBatchResult( + client.detectLanguagesWithResponse(inputs, countryHint, Context.NONE).getValue(), + getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)); + } + + /** + * Test Detect batch languages for List of String input. + */ + @Test + public void detectLanguagesBatchStringInput() { + detectLanguageStringInputRunner((inputs) -> validateBatchResult(client.detectLanguages(inputs), + getExpectedBatchDetectedLanguages(), TestEndpoint.LANGUAGE)); + } + + /** + * Verifies that a single DetectLanguageResult is returned for a text input to detectLanguages. + */ + @Test + public void detectSingleTextLanguage() { + DetectedLanguage primaryLanguage = new DetectedLanguage("English", "en", 1.0); + List expectedLanguageList = Arrays.asList(primaryLanguage); + validateDetectedLanguages( + client.detectLanguage("This is a test English Text").getDetectedLanguages(), expectedLanguageList); + } + + /** + * Verifies that an exception is thrown when null text is passed. + */ + @Test + public void detectLanguagesNullInput() { + assertThrows(NullPointerException.class, () -> client.detectBatchLanguagesWithResponse(null, null, + Context.NONE).getValue()); + } + + /** + * Verifies that the error result is returned when empty text is passed. + */ + @Test + public void detectLanguageEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + DetectLanguageResult result = client.detectLanguage(""); + assertNotNull(result.getError()); + validateErrorDocument(expectedError, result.getError()); + } + + /** + * Verifies that detectLanguage returns an "UNKNOWN" result when faulty text is passed. + */ + @Test + public void detectLanguageFaultyText() { + DetectLanguageResult result = client.detectLanguage("!@#%%"); + assertEquals(result.getPrimaryLanguage().getIso6391Name(), "(Unknown)"); + } + + /** + * Verifies that an error document is returned for a text input with invalid country hint. + *

+ * TODO: update error Model. #6559 + */ + @Test + public void detectLanguageInvalidCountryHint() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid Country Hint.", null, null); + validateErrorDocument(client.detectLanguage("Este es un document escrito en Español.", "en") + .getError(), expectedError); + } + + /** + * Verifies that a Bad request exception is returned for input documents with same ids. + */ + @Test + public void detectLanguageDuplicateIdInput() { + detectLanguageDuplicateIdRunner((inputs, options) -> { + assertRestException(() -> client.detectBatchLanguagesWithResponse(inputs, options, Context.NONE), + HttpResponseException.class, 400); + }); + } + + @Test + public void recognizeEntitiesForTextInput() { + NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); + NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); + RecognizeEntitiesResult recognizeEntitiesResultList = new RecognizeEntitiesResult("0", null, null, Arrays.asList(namedEntity1, namedEntity2)); + validateNamedEntities(recognizeEntitiesResultList.getNamedEntities(), + client.recognizeEntities("I had a wonderful trip to Seattle last week.").getNamedEntities()); + } + + @Test + public void recognizeEntitiesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + validateErrorDocument(expectedError, client.recognizeEntities("").getError()); + } + + @Test + public void recognizeEntitiesForFaultyText() { + // TODO: (savaity) confirm with service team. + assertEquals(client.recognizeEntities("!@#%%").getNamedEntities().size(), 0); + } + + @Test + public void recognizeEntitiesForBatchInput() { + recognizeBatchNamedEntityRunner((inputs) -> validateBatchResult(client.recognizeBatchEntities(inputs), + getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizeEntitiesForBatchInputShowStatistics() { + recognizeBatchNamedEntitiesShowStatsRunner((inputs, options) -> + validateBatchResult(client.recognizeBatchEntitiesWithResponse(inputs, options, Context.NONE).getValue(), + getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizePiiEntitiesForTextInput() { + NamedEntity namedEntity1 = new NamedEntity("859-98-0987", "U.S. Social Security Number (SSN)", "", 28, 11, 0.65); + RecognizeEntitiesResult recognizeEntitiesResultList = new RecognizeEntitiesResult("0", null, null, Collections.singletonList(namedEntity1)); + validateNamedEntities(recognizeEntitiesResultList.getNamedEntities(), + client.recognizePiiEntities("Microsoft employee with ssn 859-98-0987 is using our awesome API's.").getNamedEntities()); + } + + @Test + public void recognizePiiEntitiesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + validateErrorDocument(expectedError, client.recognizePiiEntities("").getError()); + } + + @Test + public void recognizePiiEntitiesForFaultyText() { + assertEquals(client.recognizePiiEntities("!@#%%").getNamedEntities().size(), 0); + } + + @Test + public void recognizePiiEntitiesForBatchInput() { + recognizeBatchPiiRunner((inputs) -> + validateBatchResult(client.recognizeBatchPiiEntities(inputs), + getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizePiiEntitiesForBatchInputShowStatistics() { + recognizeBatchPiiEntitiesShowStatsRunner((inputs, options) -> + validateBatchResult(client.recognizeBatchPiiEntitiesWithResponse(inputs, options, Context.NONE).getValue(), + getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizePiiEntitiesForBatchStringInput() { + recognizePiiStringInputRunner((inputs) -> + validateBatchResult(client.recognizePiiEntities(inputs), + getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizePiiEntitiesForListLanguageHint() { + recognizePiiLanguageHintRunner((inputs, language) -> + validateBatchResult(client.recognizePiiEntitiesWithResponse(inputs, language, Context.NONE).getValue(), + getExpectedBatchPiiEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizeEntitiesForBatchStringInput() { + recognizeNamedEntityStringInputRunner((inputs) -> + validateBatchResult(client.recognizeEntities(inputs), + getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizeEntitiesForListLanguageHint() { + recognizeNamedEntitiesLanguageHintRunner((inputs, language) -> + validateBatchResult(client.recognizeEntitiesWithResponse(inputs, language, Context.NONE).getValue(), + getExpectedBatchNamedEntities(), TestEndpoint.NAMED_ENTITY)); + } + + @Test + public void recognizeLinkedEntitiesForTextInput() { + LinkedEntityMatch linkedEntityMatch1 = new LinkedEntityMatch("Seattle", 0.11472424095537814, 7, 26); + LinkedEntity linkedEntity1 = new LinkedEntity("Seattle", Collections.singletonList(linkedEntityMatch1), "en", "Seattle", "https://en.wikipedia.org/wiki/Seattle", "Wikipedia"); + RecognizeLinkedEntitiesResult recognizeLinkedEntitiesResultList = new RecognizeLinkedEntitiesResult("0", null, null, Collections.singletonList(linkedEntity1)); + + validateLinkedEntities(recognizeLinkedEntitiesResultList.getLinkedEntities(), client.recognizeLinkedEntities("I had a wonderful trip to Seattle last week.").getLinkedEntities()); + } + + @Test + public void recognizeLinkedEntitiesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + validateErrorDocument(expectedError, client.recognizeLinkedEntities("").getError()); + } + + @Test + public void recognizeLinkedEntitiesForFaultyText() { + assertEquals(client.recognizeLinkedEntities("!@#%%").getLinkedEntities().size(), 0); + } + + @Test + public void recognizeLinkedEntitiesForBatchInput() { + recognizeBatchLinkedEntityRunner((inputs) -> + validateBatchResult(client.recognizeBatchLinkedEntities(inputs), + getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)); + } + + @Test + public void recognizeLinkedEntitiesForBatchInputShowStatistics() { + recognizeBatchLinkedEntitiesShowStatsRunner((inputs, options) -> + validateBatchResult(client.recognizeBatchLinkedEntitiesWithResponse(inputs, options, Context.NONE).getValue(), + getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)); + } + + @Test + public void recognizeLinkedEntitiesForBatchStringInput() { + recognizeLinkedStringInputRunner((inputs) -> + validateBatchResult(client.recognizeLinkedEntities(inputs), + getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)); + } + + @Test + public void recognizeLinkedEntitiesForListLanguageHint() { + recognizeLinkedLanguageHintRunner((inputs, language) -> + validateBatchResult(client.recognizeLinkedEntitiesWithResponse(inputs, language, Context.NONE).getValue(), + getExpectedBatchLinkedEntities(), TestEndpoint.LINKED_ENTITY)); + } + + @Test + public void extractKeyPhrasesForTextInput() { + List keyPhrasesList1 = Arrays.asList("monde"); + validateKeyPhrases(keyPhrasesList1, + client.extractKeyPhrasesWithResponse("Bonjour tout le monde.", "fr", Context.NONE) + .getValue().getKeyPhrases()); + } + + @Test + public void extractKeyPhrasesForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + validateErrorDocument(expectedError, client.extractKeyPhrases("").getError()); + } + + @Test + public void extractKeyPhrasesForFaultyText() { + assertEquals(client.extractKeyPhrases("!@#%%").getKeyPhrases().size(), 0); + } + + @Test + public void extractKeyPhrasesForBatchInput() { + extractBatchKeyPhrasesRunner((inputs) -> + validateBatchResult(client.extractBatchKeyPhrases(inputs), + getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)); + } + + @Test + public void extractKeyPhrasesForBatchInputShowStatistics() { + extractBatchKeyPhrasesShowStatsRunner((inputs, options) -> + validateBatchResult(client.extractBatchKeyPhrasesWithResponse(inputs, options, Context.NONE).getValue(), + getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)); + } + + @Test + public void extractKeyPhrasesForBatchStringInput() { + extractKeyPhrasesStringInputRunner((inputs) -> + validateBatchResult(client.extractKeyPhrases(inputs), + getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)); + } + + @Test + public void extractKeyPhrasesForListLanguageHint() { + extractKeyPhrasesLanguageHintRunner((inputs, language) -> + validateBatchResult(client.extractKeyPhrasesWithResponse(inputs, language, Context.NONE).getValue(), + getExpectedBatchKeyPhrases(), TestEndpoint.KEY_PHRASES)); + } + + // Sentiment + /** + * Test analyzing sentiment for a string input. + */ + @Test + public void analyseSentimentForTextInput() { + analyseBatchSentimentRunner(inputs -> validateBatchResult(client.analyzeBatchSentiment(inputs), + getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)); + } + + /** + * Verifies that an error document is returned for a empty text input. + */ + @Test + public void analyseSentimentForEmptyText() { + TextAnalyticsError expectedError = new TextAnalyticsError(ErrorCodeValue.INVALID_ARGUMENT, "Invalid document in request.", null, null); + validateErrorDocument(expectedError, client.analyzeSentiment("").getError()); + } + + @Test + public void analyseSentimentForFaultyText() { + // TODO (shawn): add this case later + } + + /** + * Test analyzing sentiment for a list of string input. + */ + @Test + public void analyseSentimentForBatchStringInput() { + analyseSentimentStringInputRunner(inputs -> + validateBatchResult(client.analyzeSentiment(inputs), getExpectedBatchTextSentiment(), + TestEndpoint.SENTIMENT)); + } + + /** + * Test analyzing sentiment for a list of string input with language hint. + */ + @Test + public void analyseSentimentForListLanguageHint() { + analyseSentimentLanguageHintRunner((inputs, language) -> + validateBatchResult(client.analyzeSentimentWithResponse(inputs, language, Context.NONE).getValue(), + getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)); + } + + /** + * Test analyzing sentiment for batch input. + */ + @Test + public void analyseSentimentForBatchInput() { + analyseBatchSentimentRunner(inputs -> validateBatchResult(client.analyzeBatchSentiment(inputs), + getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)); + } + + /** + * Verify that we can get statistics on the collection result when given a batch input with options. + */ + @Test + public void analyseSentimentForBatchInputShowStatistics() { + analyseBatchSentimentShowStatsRunner((inputs, options) -> + validateBatchResult(client.analyzeBatchSentimentWithResponse(inputs, options, Context.NONE).getValue(), + getExpectedBatchTextSentiment(), TestEndpoint.SENTIMENT)); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java new file mode 100644 index 000000000000..d510d441aa9c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java @@ -0,0 +1,1012 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; +import com.azure.ai.textanalytics.models.DetectedLanguage; +import com.azure.ai.textanalytics.models.DocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; +import com.azure.ai.textanalytics.models.LinkedEntity; +import com.azure.ai.textanalytics.models.LinkedEntityMatch; +import com.azure.ai.textanalytics.models.NamedEntity; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; +import com.azure.ai.textanalytics.models.TextAnalyticsError; +import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.models.TextDocumentStatistics; +import com.azure.ai.textanalytics.models.TextSentiment; +import com.azure.ai.textanalytics.models.TextSentimentClass; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; +import com.azure.core.credential.TokenCredential; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.test.TestBase; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.identity.DefaultAzureCredentialBuilder; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +public abstract class TextAnalyticsClientTestBase extends TestBase { + private static final String TEXT_ANALYTICS_PROPERTIES = "azure-ai-textanalytics.properties"; + private static final String NAME = "name"; + private static final String VERSION = "version"; + private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default"; + + private final Map properties = CoreUtils.getProperties(TEXT_ANALYTICS_PROPERTIES); + private final String clientName = properties.getOrDefault(NAME, "UnknownName"); + private final String clientVersion = properties.getOrDefault(VERSION, "UnknownVersion"); + private boolean showStatistics = false; + private HttpLogOptions httpLogOptions = new HttpLogOptions(); + + private static final String MODEL_VERSION = "2019-10-01"; + + enum TestEndpoint { + LANGUAGE, NAMED_ENTITY, LINKED_ENTITY, KEY_PHRASES, SENTIMENT + } + + T clientSetup(Function clientBuilder) { + TokenCredential credential = null; + + if (!interceptorManager.isPlaybackMode()) { + credential = new DefaultAzureCredentialBuilder().build(); + } + + HttpClient httpClient; + Configuration buildConfiguration = Configuration.getGlobalConfiguration().clone(); + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddDatePolicy()); + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + if (credential != null) { + policies.add(new BearerTokenAuthenticationPolicy(credential, DEFAULT_SCOPE)); + } + policies.add(new RetryPolicy()); + + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); + + if (interceptorManager.isPlaybackMode()) { + httpClient = interceptorManager.getPlaybackClient(); + } else { + httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); + } + policies.add(interceptorManager.getRecordPolicy()); + + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + T client; + client = clientBuilder.apply(pipeline); + + return Objects.requireNonNull(client); + } + + // Detect Language + @Test + abstract void detectSingleTextLanguage(); + + @Test + abstract void detectLanguageEmptyText(); + + @Test + abstract void detectLanguageFaultyText(); + + @Test + abstract void detectLanguagesBatchInput(); + + @Test + abstract void detectLanguagesBatchInputShowStatistics(); + + @Test + abstract void detectLanguagesBatchStringInput(); + + @Test + abstract void detectLanguagesBatchListCountryHint(); + + // Named Entities + @Test + abstract void recognizeEntitiesForTextInput(); + + @Test + abstract void recognizeEntitiesForEmptyText(); + + @Test + abstract void recognizeEntitiesForFaultyText(); + + @Test + abstract void recognizeEntitiesForBatchInput(); + + @Test + abstract void recognizeEntitiesForBatchInputShowStatistics(); + + @Test + abstract void recognizeEntitiesForBatchStringInput(); + + @Test + abstract void recognizeEntitiesForListLanguageHint(); + + // Pii Entities + @Test + abstract void recognizePiiEntitiesForTextInput(); + + @Test + abstract void recognizePiiEntitiesForEmptyText(); + + @Test + abstract void recognizePiiEntitiesForFaultyText(); + + @Test + abstract void recognizePiiEntitiesForBatchInput(); + + @Test + abstract void recognizePiiEntitiesForBatchInputShowStatistics(); + + @Test + abstract void recognizePiiEntitiesForBatchStringInput(); + + @Test + abstract void recognizePiiEntitiesForListLanguageHint(); + + // Linked Entities + @Test + abstract void recognizeLinkedEntitiesForTextInput(); + + @Test + abstract void recognizeLinkedEntitiesForEmptyText(); + + @Test + abstract void recognizeLinkedEntitiesForFaultyText(); + + @Test + abstract void recognizeLinkedEntitiesForBatchInput(); + + @Test + abstract void recognizeLinkedEntitiesForBatchInputShowStatistics(); + + @Test + abstract void recognizeLinkedEntitiesForBatchStringInput(); + + @Test + abstract void recognizeLinkedEntitiesForListLanguageHint(); + + // Key Phrases + @Test + abstract void extractKeyPhrasesForTextInput(); + + @Test + abstract void extractKeyPhrasesForEmptyText(); + + @Test + abstract void extractKeyPhrasesForFaultyText(); + + @Test + abstract void extractKeyPhrasesForBatchInput(); + + @Test + abstract void extractKeyPhrasesForBatchInputShowStatistics(); + + @Test + abstract void extractKeyPhrasesForBatchStringInput(); + + @Test + abstract void extractKeyPhrasesForListLanguageHint(); + + // Sentiment + @Test + abstract void analyseSentimentForTextInput(); + + @Test + abstract void analyseSentimentForEmptyText(); + + @Test + abstract void analyseSentimentForFaultyText(); + + @Test + abstract void analyseSentimentForBatchInput(); + + @Test + abstract void analyseSentimentForBatchInputShowStatistics(); + + @Test + abstract void analyseSentimentForBatchStringInput(); + + @Test + abstract void analyseSentimentForListLanguageHint(); + + // Detect Language runner + void detectLanguageShowStatisticsRunner(BiConsumer, + TextAnalyticsRequestOptions> testRunner) { + final List detectLanguageInputs = Arrays.asList( + new DetectLanguageInput("0", "This is written in English", "US"), + new DetectLanguageInput("1", "Este es un document escrito en Español."), + new DetectLanguageInput("2", "~@!~:)", "US") + ); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); + showStatistics = true; + + testRunner.accept(detectLanguageInputs, options); + } + + void detectLanguageDuplicateIdRunner(BiConsumer, + TextAnalyticsRequestOptions> testRunner) { + final List detectLanguageInputs = Arrays.asList( + new DetectLanguageInput("0", "This is written in English", "US"), + new DetectLanguageInput("0", "Este es un document escrito en Español.") + ); + + testRunner.accept(detectLanguageInputs, null); + } + + static void detectLanguagesCountryHintRunner(BiConsumer, String> testRunner) { + final List inputs = Arrays.asList( + "This is written in English", "Este es un document escrito en Español.", "~@!~:)"); + + testRunner.accept(inputs, "en"); + } + + static void detectLanguageStringInputRunner(Consumer> testRunner) { + final List inputs = Arrays.asList( + "This is written in English", "Este es un document escrito en Español.", "~@!~:)"); + + testRunner.accept(inputs); + } + + static void detectLanguageRunner(Consumer> testRunner) { + final List detectLanguageInputs = Arrays.asList( + new DetectLanguageInput("0", "This is written in English", "US"), + new DetectLanguageInput("1", "Este es un document escrito en Español."), + new DetectLanguageInput("2", "~@!~:)", "US") + ); + + testRunner.accept(detectLanguageInputs); + } + + // Named Entity runner + static void recognizeNamedEntityStringInputRunner(Consumer> testRunner) { + final List inputs = Arrays.asList( + "I had a wonderful trip to Seattle last week.", "I work at Microsoft."); + + testRunner.accept(inputs); + } + + static void recognizeNamedEntitiesLanguageHintRunner(BiConsumer, String> testRunner) { + final List inputs = Arrays.asList( + "I had a wonderful trip to Seattle last week.", "I work at Microsoft."); + + testRunner.accept(inputs, "en"); + } + + static void recognizeBatchNamedEntityRunner(Consumer> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "I had a wonderful trip to Seattle last week."), + new TextDocumentInput("1", "I work at Microsoft.")); + testRunner.accept(textDocumentInputs); + } + + void recognizeBatchNamedEntitiesShowStatsRunner( + BiConsumer, TextAnalyticsRequestOptions> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "I had a wonderful trip to Seattle last week."), + new TextDocumentInput("1", "I work at Microsoft.")); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); + showStatistics = true; + + testRunner.accept(textDocumentInputs, options); + } + + // Pii Entity runner + static void recognizePiiLanguageHintRunner(BiConsumer, String> testRunner) { + final List inputs = Arrays.asList( + "Microsoft employee with ssn 859-98-0987 is using our awesome API's.", + "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check."); + + testRunner.accept(inputs, "en"); + } + + static void recognizePiiStringInputRunner(Consumer> testRunner) { + final List inputs = Arrays.asList( + "Microsoft employee with ssn 859-98-0987 is using our awesome API's.", + "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check."); + + testRunner.accept(inputs); + } + + static void recognizeBatchPiiRunner(Consumer> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "Microsoft employee with ssn 859-98-0987 is using our awesome API's."), + new TextDocumentInput("1", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.")); + testRunner.accept(textDocumentInputs); + } + + void recognizeBatchPiiEntitiesShowStatsRunner( + BiConsumer, TextAnalyticsRequestOptions> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "Microsoft employee with ssn 859-98-0987 is using our awesome API's."), + new TextDocumentInput("1", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.")); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); + showStatistics = true; + testRunner.accept(textDocumentInputs, options); + } + + // Linked Entity runner + void recognizeBatchLinkedEntitiesShowStatsRunner( + BiConsumer, TextAnalyticsRequestOptions> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "I had a wonderful trip to Seattle last week."), + new TextDocumentInput("1", "I work at Microsoft.")); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); + showStatistics = true; + + testRunner.accept(textDocumentInputs, options); + } + + static void recognizeLinkedLanguageHintRunner(BiConsumer, String> testRunner) { + final List inputs = Arrays.asList( + "I had a wonderful trip to Seattle last week.", + "I work at Microsoft."); + + testRunner.accept(inputs, "en"); + } + + static void recognizeLinkedStringInputRunner(Consumer> testRunner) { + final List inputs = Arrays.asList( + "I had a wonderful trip to Seattle last week.", + "I work at Microsoft."); + + testRunner.accept(inputs); + } + + static void recognizeBatchLinkedEntityRunner(Consumer> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "I had a wonderful trip to Seattle last week."), + new TextDocumentInput("1", "I work at Microsoft.")); + testRunner.accept(textDocumentInputs); + } + + // Key Phrases runner + void extractBatchKeyPhrasesShowStatsRunner( + BiConsumer, TextAnalyticsRequestOptions> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "Hello world. This is some input text that I love."), + new TextDocumentInput("1", "Bonjour tout le monde", "fr")); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); + showStatistics = true; + + testRunner.accept(textDocumentInputs, options); + } + + static void extractKeyPhrasesLanguageHintRunner(BiConsumer, String> testRunner) { + final List inputs = Arrays.asList( + "Hello world. This is some input text that I love.", + "Bonjour tout le monde"); + + testRunner.accept(inputs, "en"); + } + + static void extractKeyPhrasesStringInputRunner(Consumer> testRunner) { + final List inputs = Arrays.asList( + "Hello world. This is some input text that I love.", + "Bonjour tout le monde"); + + testRunner.accept(inputs); + } + + static void extractBatchKeyPhrasesRunner(Consumer> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "Hello world. This is some input text that I love."), + new TextDocumentInput("1", "Bonjour tout le monde")); + testRunner.accept(textDocumentInputs); + } + + // Sentiment Runner + static void analyseSentimentLanguageHintRunner(BiConsumer, String> testRunner) { + testRunner.accept(getSentimentInput(), "en"); + } + + static void analyseSentimentStringInputRunner(Consumer> testRunner) { + testRunner.accept(getSentimentInput()); + } + + static void analyseBatchSentimentRunner(Consumer> testRunner) { + final List sentimentInputs = getSentimentInput(); + testRunner.accept(Arrays.asList( + new TextDocumentInput("0", sentimentInputs.get(0)), + new TextDocumentInput("1", sentimentInputs.get(1)) + )); + } + + void analyseBatchSentimentShowStatsRunner( + BiConsumer, TextAnalyticsRequestOptions> testRunner) { + final List textDocumentInputs = Arrays.asList( + new TextDocumentInput("0", "The hotel was dark and unclean. The restaurant had amazing gnocchi."), + new TextDocumentInput("1", "The restaurant had amazing gnocchi. The hotel was dark and unclean.") + ); + TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); + showStatistics = true; + + testRunner.accept(textDocumentInputs, options); + } + + static List getSentimentInput() { + return Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.", + "The restaurant had amazing gnocchi. The hotel was dark and unclean."); + } + + String getEndpoint() { + return interceptorManager.isPlaybackMode() + ? "http://localhost:8080" + : Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT"); + } + + /** + * Helper method to verify batch result. + * + * @param actualResult DocumentResultCollection<> returned by the API. + * @param testApi the API to test. + */ + void validateBatchResult(DocumentResultCollection actualResult, + DocumentResultCollection expectedResult, TestEndpoint testApi) { + // assert batch result + assertEquals(expectedResult.getModelVersion(), actualResult.getModelVersion()); + if (this.showStatistics) { + validateBatchStatistics(expectedResult.getStatistics(), actualResult.getStatistics()); + } + validateDocuments(expectedResult, actualResult, testApi); + } + + /** + * Helper method to verify documents returned in a batch request. + * + * @param expectedResult the expected result collection.. + * @param actualResult the actual result collection returned by the API. + * @param testApi the API to test. + */ + private void validateDocuments(DocumentResultCollection expectedResult, + DocumentResultCollection actualResult, TestEndpoint testApi) { + switch (testApi) { + case LANGUAGE: + final List detectLanguageResults = expectedResult.stream() + .filter(element -> element instanceof DetectLanguageResult) + .map(element -> (DetectLanguageResult) element) + .collect(Collectors.toList()); + + final List actualDetectLanguageResults = actualResult.stream() + .filter(element -> element instanceof DetectLanguageResult) + .map(element -> (DetectLanguageResult) element) + .collect(Collectors.toList()); + assertEquals(detectLanguageResults.size(), actualDetectLanguageResults.size()); + + actualDetectLanguageResults.forEach(actualItem -> { + List expectedItems = detectLanguageResults.stream().filter( + expectedEachItem -> actualItem.getId().equals(expectedEachItem.getId())) + .collect(Collectors.toList()); + assertEquals(expectedItems.size(), 1); + DetectLanguageResult expectedItem = expectedItems.get(0); + if (actualItem.getError() == null) { + if (this.showStatistics) { + validateDocumentStatistics(expectedItem.getStatistics(), actualItem.getStatistics()); + } + validatePrimaryLanguage(expectedItem.getPrimaryLanguage(), actualItem.getPrimaryLanguage()); + validateDetectedLanguages(expectedItem.getDetectedLanguages(), actualItem.getDetectedLanguages()); + } + }); + break; + case NAMED_ENTITY: + final List recognizeEntitiesResults = expectedResult.stream() + .filter(element -> element instanceof RecognizeEntitiesResult) + .map(element -> (RecognizeEntitiesResult) element) + .collect(Collectors.toList()); + + final List actualRecognizeEntitiesResults = actualResult.stream() + .filter(element -> element instanceof RecognizeEntitiesResult) + .map(element -> (RecognizeEntitiesResult) element) + .collect(Collectors.toList()); + assertEquals(recognizeEntitiesResults.size(), actualRecognizeEntitiesResults.size()); + + actualRecognizeEntitiesResults.forEach(actualItem -> { + List expectedItems = recognizeEntitiesResults.stream().filter( + expectedEachItem -> actualItem.getId().equals(expectedEachItem.getId())).collect( + Collectors.toList() + ); + assertEquals(expectedItems.size(), 1); + RecognizeEntitiesResult expectedItem = expectedItems.get(0); + if (actualItem.getError() == null) { + if (this.showStatistics) { + validateDocumentStatistics(expectedItem.getStatistics(), actualItem.getStatistics()); + } + validateNamedEntities(expectedItem.getNamedEntities(), actualItem.getNamedEntities()); + } + }); + break; + case LINKED_ENTITY: + final List recognizeLinkedEntitiesResults = expectedResult.stream() + .filter(element -> element instanceof RecognizeLinkedEntitiesResult) + .map(element -> (RecognizeLinkedEntitiesResult) element) + .collect(Collectors.toList()); + + final List actualRecognizeLinkedEntitiesResults = actualResult.stream() + .filter(element -> element instanceof RecognizeLinkedEntitiesResult) + .map(element -> (RecognizeLinkedEntitiesResult) element) + .collect(Collectors.toList()); + assertEquals(recognizeLinkedEntitiesResults.size(), actualRecognizeLinkedEntitiesResults.size()); + + actualRecognizeLinkedEntitiesResults.forEach(actualItem -> { + List expectedItems = recognizeLinkedEntitiesResults.stream().filter( + expectedEachItem -> actualItem.getId().equals(expectedEachItem.getId())) + .collect(Collectors.toList()); + assertEquals(expectedItems.size(), 1); + RecognizeLinkedEntitiesResult expectedItem = expectedItems.get(0); + if (actualItem.getError() == null) { + if (this.showStatistics) { + validateDocumentStatistics(expectedItem.getStatistics(), actualItem.getStatistics()); + } + validateLinkedEntities(expectedItem.getLinkedEntities(), actualItem.getLinkedEntities()); + } + }); + break; + case KEY_PHRASES: + final List extractKeyPhraseResults = expectedResult.stream() + .filter(element -> element instanceof ExtractKeyPhraseResult) + .map(element -> (ExtractKeyPhraseResult) element) + .collect(Collectors.toList()); + + final List actualExtractKeyPhraseResults = actualResult.stream() + .filter(element -> element instanceof ExtractKeyPhraseResult) + .map(element -> (ExtractKeyPhraseResult) element) + .collect(Collectors.toList()); + assertEquals(extractKeyPhraseResults.size(), actualExtractKeyPhraseResults.size()); + + actualExtractKeyPhraseResults.forEach(actualItem -> { + List expectedItems = extractKeyPhraseResults.stream().filter( + expectedEachItem -> actualItem.getId().equals(expectedEachItem.getId())) + .collect(Collectors.toList()); + assertEquals(expectedItems.size(), 1); + ExtractKeyPhraseResult expectedItem = expectedItems.get(0); + if (actualItem.getError() == null) { + if (this.showStatistics) { + validateDocumentStatistics(expectedItem.getStatistics(), actualItem.getStatistics()); + } + validateKeyPhrases(expectedItem.getKeyPhrases(), actualItem.getKeyPhrases()); + } + }); + break; + case SENTIMENT: + final List expectedSentimentResults = expectedResult.stream() + .filter(element -> element instanceof AnalyzeSentimentResult) + .map(element -> (AnalyzeSentimentResult) element) + .collect(Collectors.toList()); + + final List actualSentimentResults = actualResult.stream() + .filter(element -> element instanceof AnalyzeSentimentResult) + .map(element -> (AnalyzeSentimentResult) element) + .collect(Collectors.toList()); + + expectedSentimentResults.sort(Comparator.comparing(AnalyzeSentimentResult::getId)); + actualSentimentResults.sort(Comparator.comparing(AnalyzeSentimentResult::getId)); + final int actualSize = actualSentimentResults.size(); + final int expectedSize = expectedSentimentResults.size(); + assertEquals(expectedSize, actualSize); + + for (int i = 0; i < actualSize; i++) { + final AnalyzeSentimentResult actualSentimentResult = actualSentimentResults.get(i); + final AnalyzeSentimentResult expectedSentimentResult = expectedSentimentResults.get(i); + + if (actualSentimentResult.getError() == null) { + if (this.showStatistics) { + validateDocumentStatistics(expectedSentimentResult.getStatistics(), actualSentimentResult.getStatistics()); + } + validateAnalysedSentiment(expectedSentimentResult.getDocumentSentiment(), actualSentimentResult.getDocumentSentiment()); + validateAnalysedSentenceSentiment(expectedSentimentResult.getSentenceSentiments(), actualSentimentResult.getSentenceSentiments()); + } else { + validateErrorDocument(actualSentimentResult.getError(), actualSentimentResult.getError()); + } + } + break; + default: + throw new IllegalArgumentException(String.format("Unsupported testApi : '%s'.", testApi)); + } + } + + /** + * Helper method to verify TextBatchStatistics. + * + * @param expectedStatistics the expected value for TextBatchStatistics. + * @param actualStatistics the value returned by API. + */ + private static void validateBatchStatistics(TextDocumentBatchStatistics expectedStatistics, + TextDocumentBatchStatistics actualStatistics) { + assertEquals(expectedStatistics.getDocumentCount(), actualStatistics.getDocumentCount()); + assertEquals(expectedStatistics.getErroneousDocumentCount(), actualStatistics.getErroneousDocumentCount()); + assertEquals(expectedStatistics.getValidDocumentCount(), actualStatistics.getValidDocumentCount()); + assertEquals(expectedStatistics.getTransactionCount(), actualStatistics.getTransactionCount()); + } + + /** + * Helper method to verify TextDocumentStatistics. + * + * @param expected the expected value for TextDocumentStatistics. + * @param actual the value returned by API. + */ + private static void validateDocumentStatistics(TextDocumentStatistics expected, TextDocumentStatistics actual) { + assertEquals(expected.getCharacterCount(), actual.getCharacterCount()); + assertEquals(expected.getTransactionCount(), actual.getTransactionCount()); + } + + /** + * Helper method to verify LinkedEntityMatches. + * + * @param expectedLinkedEntityMatches the expected value for LinkedEntityMatches. + * @param actualLinkedEntityMatches the value returned by API. + */ + private static void validateLinkedEntityMatches(List expectedLinkedEntityMatches, + List actualLinkedEntityMatches) { + assertEquals(expectedLinkedEntityMatches.size(), actualLinkedEntityMatches.size()); + expectedLinkedEntityMatches.sort(Comparator.comparing(LinkedEntityMatch::getText)); + actualLinkedEntityMatches.sort(Comparator.comparing(LinkedEntityMatch::getText)); + + for (int i = 0; i < expectedLinkedEntityMatches.size(); i++) { + LinkedEntityMatch expectedLinkedEntity = expectedLinkedEntityMatches.get(i); + LinkedEntityMatch actualLinkedEntity = actualLinkedEntityMatches.get(i); + assertEquals(expectedLinkedEntity.getLength(), actualLinkedEntity.getLength()); + assertEquals(expectedLinkedEntity.getOffset(), actualLinkedEntity.getOffset()); + assertEquals(expectedLinkedEntity.getScore(), actualLinkedEntity.getScore()); + assertEquals(expectedLinkedEntity.getText(), actualLinkedEntity.getText()); + } + } + + /** + * Helper method to verify the error document. + * + * @param expectedError the Error returned from the service. + * @param actualError the Error returned from the API. + */ + static void validateErrorDocument(TextAnalyticsError expectedError, TextAnalyticsError actualError) { + assertEquals(expectedError.getCode(), actualError.getCode()); + assertEquals(expectedError.getMessage(), actualError.getMessage()); + assertEquals(expectedError.getTarget(), actualError.getTarget()); + } + + /** + * Helper method to validate a single detected language. + * + * @param expectedLanguage detectedLanguage returned by the service. + * @param actualLanguage detectedLanguage returned by the API. + */ + static void validatePrimaryLanguage(DetectedLanguage expectedLanguage, DetectedLanguage actualLanguage) { + assertEquals(expectedLanguage.getIso6391Name(), actualLanguage.getIso6391Name()); + assertEquals(expectedLanguage.getName(), actualLanguage.getName()); + assertEquals(expectedLanguage.getScore(), actualLanguage.getScore()); + } + + /** + * Helper method to validate the list of detected languages. + * + * @param expectedLanguageList detectedLanguages returned by the service. + * @param actualLanguageList detectedLanguages returned by the API. + */ + static void validateDetectedLanguages(List expectedLanguageList, + List actualLanguageList) { + assertEquals(expectedLanguageList.size(), actualLanguageList.size()); + expectedLanguageList.sort(Comparator.comparing(DetectedLanguage::getName)); + actualLanguageList.sort(Comparator.comparing(DetectedLanguage::getName)); + + for (int i = 0; i < expectedLanguageList.size(); i++) { + DetectedLanguage expectedDetectedLanguage = expectedLanguageList.get(i); + DetectedLanguage actualDetectedLanguage = actualLanguageList.get(i); + validatePrimaryLanguage(expectedDetectedLanguage, actualDetectedLanguage); + } + } + + /** + * Helper method to validate a single named entity. + * + * @param expectedNamedEntity namedEntity returned by the service. + * @param actualNamedEntity namedEntity returned by the API. + */ + static void validateNamedEntity(NamedEntity expectedNamedEntity, NamedEntity actualNamedEntity) { + + assertEquals(expectedNamedEntity.getLength(), actualNamedEntity.getLength()); + assertEquals(expectedNamedEntity.getOffset(), actualNamedEntity.getOffset()); + assertEquals(expectedNamedEntity.getScore(), actualNamedEntity.getScore()); + assertEquals(expectedNamedEntity.getSubtype(), actualNamedEntity.getSubtype()); + assertEquals(expectedNamedEntity.getText(), actualNamedEntity.getText()); + assertEquals(expectedNamedEntity.getType(), actualNamedEntity.getType()); + + } + + /** + * Helper method to validate a single named entity. + * + * @param expectedLinkedEntity namedEntity returned by the service. + * @param actualLinkedEntity namedEntity returned by the API. + */ + static void validateLinkedEntity(LinkedEntity expectedLinkedEntity, LinkedEntity actualLinkedEntity) { + + assertEquals(expectedLinkedEntity.getName(), actualLinkedEntity.getName()); + assertEquals(expectedLinkedEntity.getDataSource(), actualLinkedEntity.getDataSource()); + assertEquals(expectedLinkedEntity.getLanguage(), actualLinkedEntity.getLanguage()); + assertEquals(expectedLinkedEntity.getUrl(), actualLinkedEntity.getUrl()); + assertEquals(expectedLinkedEntity.getId(), actualLinkedEntity.getId()); + validateLinkedEntityMatches(expectedLinkedEntity.getLinkedEntityMatches(), actualLinkedEntity.getLinkedEntityMatches()); + } + + /** + * Helper method to validate a single key phrase. + * + * @param expectedKeyPhrases key phrases returned by the service. + * @param actualKeyPhrases key phrases returned by the API. + */ + void validateKeyPhrases(List expectedKeyPhrases, List actualKeyPhrases) { + assertEquals(expectedKeyPhrases.size(), actualKeyPhrases.size()); + Collections.sort(expectedKeyPhrases); + Collections.sort(actualKeyPhrases); + + for (int i = 0; i < expectedKeyPhrases.size(); i++) { + assertTrue(expectedKeyPhrases.get(i).equals(actualKeyPhrases.get(i))); + } + } + + /** + * Helper method to validate the list of named entities. + * + * @param expectedNamedEntityList namedEntities returned by the service. + * @param actualNamedEntityList namedEntities returned by the API. + */ + static void validateNamedEntities(List expectedNamedEntityList, + List actualNamedEntityList) { + assertEquals(expectedNamedEntityList.size(), actualNamedEntityList.size()); + expectedNamedEntityList.sort(Comparator.comparing(NamedEntity::getText)); + actualNamedEntityList.sort(Comparator.comparing(NamedEntity::getText)); + + for (int i = 0; i < expectedNamedEntityList.size(); i++) { + NamedEntity expectedNamedEntity = expectedNamedEntityList.get(i); + NamedEntity actualNamedEntity = actualNamedEntityList.get(i); + validateNamedEntity(expectedNamedEntity, actualNamedEntity); + } + } + + /** + * Helper method to validate the list of named entities. + * + * @param expectedLinkedEntityList namedEntities returned by the service. + * @param actualLinkedEntityList namedEntities returned by the API. + */ + static void validateLinkedEntities(List expectedLinkedEntityList, + List actualLinkedEntityList) { + assertEquals(expectedLinkedEntityList.size(), actualLinkedEntityList.size()); + expectedLinkedEntityList.sort(Comparator.comparing(LinkedEntity::getName)); + actualLinkedEntityList.sort(Comparator.comparing(LinkedEntity::getName)); + + for (int i = 0; i < expectedLinkedEntityList.size(); i++) { + LinkedEntity expectedLinkedEntity = expectedLinkedEntityList.get(i); + LinkedEntity actualLinkedEntity = actualLinkedEntityList.get(i); + validateLinkedEntity(expectedLinkedEntity, actualLinkedEntity); + } + } + + /** + * Helper method to validate the list of sentence sentiment. Can't really validate score numbers because it + * frequently changed by background model computation. + * + * @param expectedSentimentList a list of analyzed sentence sentiment returned by the service. + * @param actualSentimentList a list of analyzed sentence sentiment returned by the API. + */ + static void validateAnalysedSentenceSentiment(List expectedSentimentList, + List actualSentimentList) { + + assertEquals(expectedSentimentList.size(), actualSentimentList.size()); + for (int i = 0; i < expectedSentimentList.size(); i++) { + validateAnalysedSentiment(expectedSentimentList.get(i), actualSentimentList.get(i)); + } + } + + /** + * Helper method to validate one pair of analysed sentiments. Can't really validate score numbers because it + * frequently changed by background model computation. + * + * @param expectedSentiment analyzed document sentiment returned by the service. + * @param actualSentiment analyzed document sentiment returned by the API. + */ + static void validateAnalysedSentiment(TextSentiment expectedSentiment, TextSentiment actualSentiment) { + assertEquals(expectedSentiment.getLength(), actualSentiment.getLength()); + assertEquals(expectedSentiment.getOffset(), actualSentiment.getOffset()); + assertEquals(expectedSentiment.getTextSentimentClass(), actualSentiment.getTextSentimentClass()); + + assertEquals(expectedSentiment.getNegativeScore() > 0, actualSentiment.getNegativeScore() > 0); + assertEquals(expectedSentiment.getNeutralScore() > 0, actualSentiment.getNeutralScore() > 0); + assertEquals(expectedSentiment.getPositiveScore() > 0, actualSentiment.getPositiveScore() > 0); + } + + static void assertRestException(Throwable exception, Class expectedExceptionType, + int expectedStatusCode) { + assertEquals(expectedExceptionType, exception.getClass()); + assertEquals(expectedStatusCode, ((HttpResponseException) exception).getResponse().getStatusCode()); + } + + static void assertRestException(Runnable exceptionThrower, + Class expectedExceptionType, int expectedStatusCode) { + try { + exceptionThrower.run(); + fail(); + } catch (Throwable ex) { + assertRestException(ex, expectedExceptionType, expectedStatusCode); + } + } + + /** + * Helper method to get the expected Batch Detected Languages + */ + static DocumentResultCollection getExpectedBatchDetectedLanguages() { + DetectedLanguage detectedLanguage1 = new DetectedLanguage("English", "en", 1.0); + DetectedLanguage detectedLanguage2 = new DetectedLanguage("Spanish", "es", 1.0); + DetectedLanguage detectedLanguage3 = new DetectedLanguage("(Unknown)", "(Unknown)", 0.0); + List detectedLanguageList1 = Collections.singletonList(detectedLanguage1); + List detectedLanguageList2 = Collections.singletonList(detectedLanguage2); + List detectedLanguageList3 = Collections.singletonList(detectedLanguage3); + + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(26, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(39, 1); + TextDocumentStatistics textDocumentStatistics3 = new TextDocumentStatistics(6, 1); + + DetectLanguageResult detectLanguageResult1 = new DetectLanguageResult("0", textDocumentStatistics1, null, detectedLanguage1, detectedLanguageList1); + DetectLanguageResult detectLanguageResult2 = new DetectLanguageResult("1", textDocumentStatistics2, null, detectedLanguage2, detectedLanguageList2); + DetectLanguageResult detectLanguageResult3 = new DetectLanguageResult("2", textDocumentStatistics3, null, detectedLanguage3, detectedLanguageList3); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(3, 3, 0, 3); + List detectLanguageResultList = Arrays.asList(detectLanguageResult1, detectLanguageResult2, detectLanguageResult3); + + return new DocumentResultCollection<>(detectLanguageResultList, MODEL_VERSION, textDocumentBatchStatistics); + } + + static DocumentResultCollection getExpectedBatchNamedEntities() { + NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); + NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); + NamedEntity namedEntity3 = new NamedEntity("Microsoft", "Organization", null, 10, 9, 0.99983596801757812); + + List namedEntityList1 = Arrays.asList(namedEntity1, namedEntity2); + List namedEntityList2 = Collections.singletonList(namedEntity3); + + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(44, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(20, 1); + + RecognizeEntitiesResult recognizeEntitiesResult1 = new RecognizeEntitiesResult("0", textDocumentStatistics1, null, namedEntityList1); + RecognizeEntitiesResult recognizeEntitiesResult2 = new RecognizeEntitiesResult("1", textDocumentStatistics2, null, namedEntityList2); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); + List recognizeEntitiesResultList = Arrays.asList(recognizeEntitiesResult1, recognizeEntitiesResult2); + + return new DocumentResultCollection<>(recognizeEntitiesResultList, MODEL_VERSION, textDocumentBatchStatistics); + } + + static DocumentResultCollection getExpectedBatchPiiEntities() { + NamedEntity namedEntity1 = new NamedEntity("859-98-0987", "U.S. Social Security Number (SSN)", "", 28, 11, 0.65); + NamedEntity namedEntity2 = new NamedEntity("111000025", "ABA Routing Number", "", 18, 9, 0.75); + + List namedEntityList1 = Collections.singletonList(namedEntity1); + List namedEntityList2 = Collections.singletonList(namedEntity2); + + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(67, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(105, 1); + + RecognizePiiEntitiesResult recognizeEntitiesResult1 = new RecognizePiiEntitiesResult("0", textDocumentStatistics1, null, namedEntityList1); + RecognizePiiEntitiesResult recognizeEntitiesResult2 = new RecognizePiiEntitiesResult("1", textDocumentStatistics2, null, namedEntityList2); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); + List recognizeEntitiesResultList = Arrays.asList(recognizeEntitiesResult1, recognizeEntitiesResult2); + + return new DocumentResultCollection<>(recognizeEntitiesResultList, MODEL_VERSION, textDocumentBatchStatistics); + } + + static DocumentResultCollection getExpectedBatchLinkedEntities() { + LinkedEntityMatch linkedEntityMatch1 = new LinkedEntityMatch("Seattle", 0.11472424095537814, 7, 26); + LinkedEntityMatch linkedEntityMatch2 = new LinkedEntityMatch("Microsoft", 0.18693659716732069, 9, 10); + + LinkedEntity linkedEntity1 = new LinkedEntity( + "Seattle", Collections.singletonList(linkedEntityMatch1), + "en", "Seattle", "https://en.wikipedia.org/wiki/Seattle", + "Wikipedia"); + + LinkedEntity linkedEntity2 = new LinkedEntity( + "Microsoft", Collections.singletonList(linkedEntityMatch2), + "en", "Microsoft", "https://en.wikipedia.org/wiki/Microsoft", + "Wikipedia"); + + List linkedEntityList1 = Collections.singletonList(linkedEntity1); + List linkedEntityList2 = Collections.singletonList(linkedEntity2); + + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(44, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(20, 1); + + RecognizeLinkedEntitiesResult recognizeLinkedEntitiesResult1 = new RecognizeLinkedEntitiesResult("0", textDocumentStatistics1, null, linkedEntityList1); + RecognizeLinkedEntitiesResult recognizeLinkedEntitiesResult2 = new RecognizeLinkedEntitiesResult("1", textDocumentStatistics2, null, linkedEntityList2); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); + List recognizeLinkedEntitiesResultList = Arrays.asList(recognizeLinkedEntitiesResult1, recognizeLinkedEntitiesResult2); + + return new DocumentResultCollection<>(recognizeLinkedEntitiesResultList, MODEL_VERSION, textDocumentBatchStatistics); + } + + static DocumentResultCollection getExpectedBatchKeyPhrases() { + List keyPhrasesList1 = Arrays.asList("input text", "world"); + List keyPhrasesList2 = Arrays.asList("monde"); + + TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(49, 1); + TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(21, 1); + + ExtractKeyPhraseResult extractKeyPhraseResult1 = new ExtractKeyPhraseResult("0", textDocumentStatistics1, null, keyPhrasesList1); + ExtractKeyPhraseResult extractKeyPhraseResult2 = new ExtractKeyPhraseResult("1", textDocumentStatistics2, null, keyPhrasesList2); + + TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); + List extractKeyPhraseResultList = Arrays.asList(extractKeyPhraseResult1, extractKeyPhraseResult2); + + return new DocumentResultCollection<>(extractKeyPhraseResultList, MODEL_VERSION, textDocumentBatchStatistics); + } + + static DocumentResultCollection getExpectedBatchTextSentiment() { + final TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(67, 1); + final TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(67, 1); + + final TextSentiment expectedDocumentSentiment = new TextSentiment(TextSentimentClass.MIXED, + 0.1, 0.5, 0.4, 66, 0); + + final AnalyzeSentimentResult analyzeSentimentResult1 = new AnalyzeSentimentResult("0", textDocumentStatistics1, + null, + expectedDocumentSentiment, + Arrays.asList( + new TextSentiment(TextSentimentClass.NEGATIVE, 0.99, 0.005, 0.005, 31, 0), + new TextSentiment(TextSentimentClass.POSITIVE, 0.005, 0.005, 0.99, 35, 32) + )); + + final AnalyzeSentimentResult analyzeSentimentResult2 = new AnalyzeSentimentResult("1", textDocumentStatistics2, + null, + expectedDocumentSentiment, + Arrays.asList( + new TextSentiment(TextSentimentClass.POSITIVE, 0.005, 0.005, 0.99, 35, 0), + new TextSentiment(TextSentimentClass.NEGATIVE, 0.99, 0.005, 0.005, 31, 36) + )); + + return new DocumentResultCollection<>(Arrays.asList(analyzeSentimentResult1, analyzeSentimentResult2), + MODEL_VERSION, + new TextDocumentBatchStatistics(2, 2, 0, 2)); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInput.json new file mode 100644 index 000000000000..93bafb2af6dd --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/sentiment", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "bf7faa24-cf2d-48a2-b5a0-4839675aa06d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "67", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "6ed77caa-7761-4a25-afce-f37f8a60efcf", + "x-aml-ta-request-id" : "87035b65-f78c-40a9-b459-3d016bdeb20a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":0,\"length\":31},{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":32,\"length\":35}]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":0,\"length\":35},{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":36,\"length\":31}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 20:43:32 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInputShowStatistics.json new file mode 100644 index 000000000000..1743cd120c65 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchInputShowStatistics.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/sentiment?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "26c1f86c-5406-45ef-8c38-0b88b6a9ee10", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "60", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "6c82ea83-668f-4271-9fa3-0cc085e488cb", + "x-aml-ta-request-id" : "9a184222-e1ba-4b35-800a-0043c3026dd8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":0,\"length\":31},{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":32,\"length\":35}]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":0,\"length\":35},{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":36,\"length\":31}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 20:43:25 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchStringInput.json new file mode 100644 index 000000000000..a7601afb38d0 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForBatchStringInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/sentiment", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "49cc98cd-a9a6-47ab-8436-794c4639fe0a", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "72", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "24cf6a35-734c-4aad-a1be-aa1be6a46518", + "x-aml-ta-request-id" : "f4b4ea38-f3d8-48af-bf43-232e549a6331", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":0,\"length\":31},{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":32,\"length\":35}]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":0,\"length\":35},{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":36,\"length\":31}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 20:43:30 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForEmptyText.json new file mode 100644 index 000000000000..d1cb1f9abdfc --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForEmptyText.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/sentiment", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2fb51e4d-367e-466c-b23f-69f368e06e61", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "1", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ab72127f-7d59-4faf-b220-79c937ba79ea", + "x-aml-ta-request-id" : "4595ea83-9cd4-43d5-823c-6ca4260c34ae", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"},\"message\":\"Invalid document in request.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 20:43:31 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForFaultyText.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForFaultyText.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForListLanguageHint.json new file mode 100644 index 000000000000..dcff83114c1c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForListLanguageHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/sentiment", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "39e2b93d-5a80-47c4-baaa-0222f0ef037c", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "63", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "93a951b1-5086-4eab-b445-ffa38afddeba", + "x-aml-ta-request-id" : "bb3d367a-e339-47f8-9a96-97a1335964be", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":0,\"length\":31},{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":32,\"length\":35}]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":0,\"length\":35},{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":36,\"length\":31}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 20:43:29 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForTextInput.json new file mode 100644 index 000000000000..ecbd7d0d13fa --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyseSentimentForTextInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/sentiment", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "813c1778-0c1a-43f8-861b-8a0be1657d30", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "70", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "1db73d1e-6539-41ea-bf69-f22f7e9bb266", + "x-aml-ta-request-id" : "50bfa3c0-c0b0-491b-a482-1dc62e019a8e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":0,\"length\":31},{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":32,\"length\":35}]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"documentScores\":{\"positive\":0.49978500604629522,\"neutral\":0.0001903649390442,\"negative\":0.500024676322937},\"sentences\":[{\"sentiment\":\"positive\",\"sentenceScores\":{\"positive\":0.99952912330627441,\"neutral\":0.0003318602975924,\"negative\":0.000139072391903},\"offset\":0,\"length\":35},{\"sentiment\":\"negative\",\"sentenceScores\":{\"positive\":4.08880950999E-05,\"neutral\":4.88695768581E-05,\"negative\":0.99991023540496826},\"offset\":36,\"length\":31}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 20:43:33 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguage.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguage.json new file mode 100644 index 000000000000..3aa910433cce --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguage.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dbabcca5-547d-4681-b266-ce49d02ed22e", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "4", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "6a49b00e-c7d6-471b-b4ee-8a68a20d2a50", + "x-aml-ta-request-id" : "70e5eede-3999-49e6-afe8-729dfdb48d4e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 06 Dec 2019 23:45:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json new file mode 100644 index 000000000000..4f36ba008693 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageDuplicateIdInput.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "aabc5399-ae00-4ead-8ead-bca8b1989d7d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "4", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "54177f2c-6394-44d2-b2eb-a972ad56c0d3", + "x-aml-ta-request-id" : "2eeef4d1-c228-4733-98b2-31b9c2fbbae1", + "retry-after" : "0", + "StatusCode" : "400", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"},\"message\":\"Invalid document in request.\"}}", + "Date" : "Sun, 15 Dec 2019 18:40:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json new file mode 100644 index 000000000000..125d1b23ee4b --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageEmptyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e4c37fd8-d81c-4ab7-a517-89257f475b92", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=0", + "apim-request-id" : "1854038a-38d2-485c-960e-6ed5820ec990", + "x-aml-ta-request-id" : "5a2557a4-c158-4378-94e7-1b39f8605a62", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"},\"message\":\"Invalid document in request.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:40:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json new file mode 100644 index 000000000000..5e796018297d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageFaultyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d3a5ab6f-88f1-4391-afe9-f45f8ab573e0", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "3", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "453f0d88-f510-421d-b79c-cf95a628e6be", + "x-aml-ta-request-id" : "2afe0f54-c9e9-4c61-96e5-f6b6243f428c", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:41:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json new file mode 100644 index 000000000000..a939e8fb3fe0 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageInvalidCountryHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c628558e-16be-4406-8e3f-c16a5872ccf7", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=0", + "apim-request-id" : "2f848a95-6b34-41bf-9a70-c639559eae87", + "x-aml-ta-request-id" : "240f51c5-2f65-466a-9f7c-8f32e1bee371", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidCountryHint\",\"message\":\"Country hint is not valid. Please specify an ISO 3166-1 alpha-2 two letter country code.\"},\"message\":\"Invalid Country Hint.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:40:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNullText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNullText.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguageNullText.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json new file mode 100644 index 000000000000..cd1caf761f36 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3f29b175-67c1-4323-a35a-de116b207383", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "5", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "43b9ec52-c955-4eeb-a1a5-2797a8207890", + "x-aml-ta-request-id" : "d192d264-5fc2-41ab-8bfd-13adfc42d6b1", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}]},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:41:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json new file mode 100644 index 000000000000..fb399249cba1 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatistics.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e4223261-bd5d-4fe2-9554-e4e5446c56f4", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "f8999cef-f30b-4ffa-a471-9c8748c9fa47", + "x-aml-ta-request-id" : "25923640-7e6f-4e17-93db-625c1851e727", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}],\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1}},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}],\"statistics\":{\"charactersCount\":39,\"transactionsCount\":1}},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}],\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1}}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:40:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json new file mode 100644 index 000000000000..78dc5f5301c3 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchInputShowStatisticsNew.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7bbf00ca-d6c7-4e17-9bf4-6bdc587fbdb1", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "0a3819af-a97d-4279-9c1c-30e216082788", + "x-aml-ta-request-id" : "78f53879-b38b-40ec-b441-e47ebc2c5905", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":3,\"validDocumentsCount\":3,\"erroneousDocumentsCount\":0,\"transactionsCount\":3},\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}],\"statistics\":{\"charactersCount\":26,\"transactionsCount\":1}},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}],\"statistics\":{\"charactersCount\":39,\"transactionsCount\":1}},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}],\"statistics\":{\"charactersCount\":6,\"transactionsCount\":1}}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 06 Dec 2019 23:45:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json new file mode 100644 index 000000000000..bdc0dd1917b2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchListCountryHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "de228f54-3435-4075-bbe2-84d568ba00c5", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "5", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "ff18a335-ae1e-4041-b7ea-a723e1fe7e1c", + "x-aml-ta-request-id" : "0c8a99c1-0d5e-4e28-9b9d-2e5d54de567a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}]},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:40:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json new file mode 100644 index 000000000000..3948fdfc3bda --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e55e2090-42ea-46ce-8916-c0302d77ef20", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "5", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "79cf04cb-21fb-4ca5-9777-03bba3ad58c3", + "x-aml-ta-request-id" : "855d6420-bc78-49fa-853c-3f488453720b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}]},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:40:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json new file mode 100644 index 000000000000..5af42401c1a1 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesBatchStringList.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f2c6afdf-c7d9-4b64-bb47-df7a395fb176", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=3", + "apim-request-id" : "9f374d46-7574-40a3-8f1f-909d785f9bbb", + "x-aml-ta-request-id" : "5927da90-8c7b-4102-916c-b49197615813", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]},{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"Spanish\",\"iso6391Name\":\"es\",\"score\":1.0}]},{\"id\":\"2\",\"detectedLanguages\":[{\"name\":\"(Unknown)\",\"iso6391Name\":\"(Unknown)\",\"score\":0.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 06 Dec 2019 23:45:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesNullInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesNullInput.json new file mode 100644 index 000000000000..d0bcd82c3793 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectLanguagesNullInput.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "fffb67be-78ff-4424-baeb-3889230fdd96", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7b1a2495-4fab-43d3-ade1-fbd1301ed885", + "x-aml-ta-request-id" : "ba0643bc-a413-42c3-9da2-d852beb22bb9", + "retry-after" : "0", + "StatusCode" : "400", + "Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"innerError\":{\"code\":\"MissingInputRecords\",\"message\":\"Missing input records.\"},\"message\":\"Invalid Request.\"}}", + "Date" : "Sun, 15 Dec 2019 18:40:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json new file mode 100644 index 000000000000..499490600f13 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/detectSingleTextLanguage.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/languages", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "42c2e666-5591-4307-a822-0e32dd28fde6", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "3", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "bf650aba-ca58-41fe-a7bc-3ee2bb7b85c0", + "x-aml-ta-request-id" : "1fa535eb-5585-4d65-b242-c7686270f6a2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Sun, 15 Dec 2019 18:40:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json new file mode 100644 index 000000000000..25ceb4b396fa --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c06ff081-7cd8-4067-9a79-4e4abeb64e19", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "11", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "6d0a7ed6-0460-4828-be82-7e00e73857d4", + "x-aml-ta-request-id" : "8cfb3cb4-c4a9-46b9-aec6-c69e705ca62e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:33:53 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json new file mode 100644 index 000000000000..ff3104b125f8 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchInputShowStatistics.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cfeb9641-e809-4708-b37f-88358eaf0312", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "429897b3-0b7c-4d5c-9203-6eaab27da52f", + "x-aml-ta-request-id" : "c8d65a02-0651-4cf4-917a-f206f6f740c6", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"],\"statistics\":{\"charactersCount\":49,\"transactionsCount\":1}},{\"id\":\"1\",\"keyPhrases\":[\"monde\"],\"statistics\":{\"charactersCount\":21,\"transactionsCount\":1}}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:43:54 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json new file mode 100644 index 000000000000..55614eba5530 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForBatchStringInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "df579208-6407-49fe-8fef-d54739727c5f", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "10", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "688d17a4-b114-4dc0-b2e8-fdff4de5500e", + "x-aml-ta-request-id" : "1b8e4fea-2ab2-4a3e-a5ab-223d7220aa30", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:32:49 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json new file mode 100644 index 000000000000..8e5ca5af1752 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForEmptyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "47189e17-8ea9-48d4-a991-2bdc3a4ce8a2", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=0", + "apim-request-id" : "b4f085bb-9cfa-4c4e-be6a-6e9e99419fb0", + "x-aml-ta-request-id" : "f3b8109f-1cca-44bd-ac1c-9d2d1bd66220", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"},\"message\":\"Invalid document in request.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:32:49 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json new file mode 100644 index 000000000000..304ef66d9660 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForFaultyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d825fe65-81b2-4959-8a04-323619abc8ff", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "5", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "5ae0d526-c2e7-42e1-b9bb-ff4b5e39e6de", + "x-aml-ta-request-id" : "a1f3e143-7ec6-4976-80c5-7380890ee157", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Mon, 16 Dec 2019 19:27:02 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json new file mode 100644 index 000000000000..d750249ae6d9 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForListLanguageHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "d6a9fd72-8233-4c03-b4a2-c9c361a8421e", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "11", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "38b9abb6-c8bc-468a-8c0c-91cec945baa0", + "x-aml-ta-request-id" : "ddb68a95-84b6-4aa8-8bac-260a4edbb63c", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"input text\",\"world\"]},{\"id\":\"1\",\"keyPhrases\":[\"monde\"]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:32:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json new file mode 100644 index 000000000000..d28de74cbb6d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/extractKeyPhrasesForTextInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/keyPhrases", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "3be7e42b-301a-4db9-970e-e707d60caeac", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "fb026813-d781-4208-9f69-e23041e738fa", + "x-aml-ta-request-id" : "165e0b26-d158-46ee-a966-5439fd8ed098", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"keyPhrases\":[\"monde\"]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:33:53 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json new file mode 100644 index 000000000000..36af23b61fe9 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "2167dc9e-e029-4b67-85fe-a00d762e9d1c", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "27", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "49d733e3-7dde-4748-952a-41575950a776", + "x-aml-ta-request-id" : "5e28ec93-2366-447a-a4ce-33e0d27cec4b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Seattle\",\"type\":\"Location\",\"offset\":26,\"length\":7,\"score\":0.80624294281005859},{\"text\":\"last week\",\"type\":\"DateTime\",\"subtype\":\"DateRange\",\"offset\":34,\"length\":9,\"score\":0.8}]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"type\":\"Organization\",\"offset\":10,\"length\":9,\"score\":0.99983596801757812}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:31:45 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json new file mode 100644 index 000000000000..7f1e954f5b65 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchInputShowStatistics.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "4c60a884-a487-4526-a413-1b76f05d11e5", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "28", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "35615485-3f74-48c5-a275-52a832d03c42", + "x-aml-ta-request-id" : "9fcb9f03-2f4d-4863-82bc-162f0ac1a276", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"text\":\"Seattle\",\"type\":\"Location\",\"offset\":26,\"length\":7,\"score\":0.80624294281005859},{\"text\":\"last week\",\"type\":\"DateTime\",\"subtype\":\"DateRange\",\"offset\":34,\"length\":9,\"score\":0.8}]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"text\":\"Microsoft\",\"type\":\"Organization\",\"offset\":10,\"length\":9,\"score\":0.99983596801757812}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:36:04 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchListCountryHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchListCountryHint.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchListCountryHint.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json new file mode 100644 index 000000000000..7ded1269c69b --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForBatchStringInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "cdf9970f-de45-405a-94e8-45b73808ae92", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "32", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "be5aedfc-5e5e-459f-883c-1b48a1bb845b", + "x-aml-ta-request-id" : "d61bbcb2-4bd0-4930-981a-46b6493ceecf", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Seattle\",\"type\":\"Location\",\"offset\":26,\"length\":7,\"score\":0.80624294281005859},{\"text\":\"last week\",\"type\":\"DateTime\",\"subtype\":\"DateRange\",\"offset\":34,\"length\":9,\"score\":0.8}]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"type\":\"Organization\",\"offset\":10,\"length\":9,\"score\":0.99983596801757812}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:31:49 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json new file mode 100644 index 000000000000..d95682eb0df5 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForEmptyText.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "1221c2bb-9541-4201-a2ce-ff119ba77dc9", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b90ddc69-b691-4008-95d4-8f7ce3029cfa", + "x-aml-ta-request-id" : "fb985580-7eff-4032-bb58-5744906a215a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"},\"message\":\"Invalid document in request.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:35:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json new file mode 100644 index 000000000000..7195afe1b6da --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForFaultyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "ea8835bd-4259-4867-9c01-e1845882c1bf", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "29", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "64334c9b-a767-419f-b5d0-cfb331a405e8", + "x-aml-ta-request-id" : "84ca812c-7b19-48b3-b254-8b27ac149336", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 27 Dec 2019 22:10:43 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json new file mode 100644 index 000000000000..31980fd4fb92 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForListLanguageHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "34d87319-7ac1-44f2-905a-f7b22515e361", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "20", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "2296fd92-81ee-4490-b426-60a7ec2594db", + "x-aml-ta-request-id" : "6d1cd136-6489-40dd-9a83-e1562a229c7d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Seattle\",\"type\":\"Location\",\"offset\":26,\"length\":7,\"score\":0.80624294281005859},{\"text\":\"last week\",\"type\":\"DateTime\",\"subtype\":\"DateRange\",\"offset\":34,\"length\":9,\"score\":0.8}]},{\"id\":\"1\",\"entities\":[{\"text\":\"Microsoft\",\"type\":\"Organization\",\"offset\":10,\"length\":9,\"score\":0.99983596801757812}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:31:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForSimpleInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForSimpleInput.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForSimpleInput.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json new file mode 100644 index 000000000000..5f316cdc5699 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeEntitiesForTextInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/general", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9d68d9ec-caee-470e-b90a-e9248e7e112c", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "21", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "3606bada-cdf7-459e-b27f-3076fad38893", + "x-aml-ta-request-id" : "4f5d9ea4-038b-4da3-a865-86edf7104b51", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"Seattle\",\"type\":\"Location\",\"offset\":26,\"length\":7,\"score\":0.80624294281005859},{\"text\":\"last week\",\"type\":\"DateTime\",\"subtype\":\"DateRange\",\"offset\":34,\"length\":9,\"score\":0.8}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:35:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json new file mode 100644 index 000000000000..8a830ad877cc --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "801ab3cf-aa2a-43c7-add5-e1c8e8a2b49d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "12", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "dd8d437b-aa02-4be1-8a96-bfb6591755ae", + "x-aml-ta-request-id" : "d7bbf941-abd6-44c3-9658-6922a117da0c", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"score\":0.11472424095537814}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}]},{\"id\":\"1\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"score\":0.18693659716732069}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:32:51 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json new file mode 100644 index 000000000000..f92232db6b70 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchInputShowStatistics.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "17da0fae-061a-4b79-a605-addb46a09b95", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "14", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "56651941-2cb9-4113-8a2c-9b473f517058", + "x-aml-ta-request-id" : "a7782d77-f675-498c-87a5-b4cb7868346d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":44,\"transactionsCount\":1},\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"score\":0.11472424095537814}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":20,\"transactionsCount\":1},\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"score\":0.18693659716732069}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:35:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json new file mode 100644 index 000000000000..42498d9f6e13 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForBatchStringInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "10dc1e7a-05e9-489f-8568-b4c8be54790d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "23", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "20720445-eb4f-4ce7-b89b-43792d6f879f", + "x-aml-ta-request-id" : "1cac6013-2ba1-492d-8395-b91cd2d134e4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"score\":0.11472424095537814}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}]},{\"id\":\"1\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"score\":0.18693659716732069}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:39:25 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json new file mode 100644 index 000000000000..c64b5bd92211 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForEmptyText.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9d57fa09-3847-4d14-a9aa-be82464d592b", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "193e013b-5f7d-4597-a924-39739e88b377", + "x-aml-ta-request-id" : "781c87ff-a6a8-4c48-9c96-b4097ac44128", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"},\"message\":\"Invalid document in request.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:39:26 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json new file mode 100644 index 000000000000..2ea55fb270bb --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForFaultyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "edab5962-f052-40b3-83f3-3a7f11e52d3e", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "5017", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "f2d5e5a9-ebf8-49d8-8354-13429b5d7a02", + "x-aml-ta-request-id" : "f6615e24-9bca-481a-b3d9-30a55ffd391f", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:35:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json new file mode 100644 index 000000000000..f2885add0808 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForListLanguageHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "9f604d8e-9e35-4fdd-913d-1e2b4b41ad6d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "15", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "c9959676-d6cb-43ee-8b46-add4ac6273f7", + "x-aml-ta-request-id" : "37d2a4ca-cad6-493f-81f4-6e4b40fbe8c8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"score\":0.11472424095537814}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}]},{\"id\":\"1\",\"entities\":[{\"name\":\"Microsoft\",\"matches\":[{\"text\":\"Microsoft\",\"offset\":10,\"length\":9,\"score\":0.18693659716732069}],\"language\":\"en\",\"id\":\"Microsoft\",\"url\":\"https://en.wikipedia.org/wiki/Microsoft\",\"dataSource\":\"Wikipedia\"}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:39:25 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json new file mode 100644 index 000000000000..7033022a322f --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizeLinkedEntitiesForTextInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/linking", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "c70b3abe-b742-4fe0-99f6-fcfb50a72ac4", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "11", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "0590ca51-9475-4de7-8a58-023ae983eef6", + "x-aml-ta-request-id" : "9df16f76-7828-4be0-9515-bc479fb85195", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"name\":\"Seattle\",\"matches\":[{\"text\":\"Seattle\",\"offset\":26,\"length\":7,\"score\":0.11472424095537814}],\"language\":\"en\",\"id\":\"Seattle\",\"url\":\"https://en.wikipedia.org/wiki/Seattle\",\"dataSource\":\"Wikipedia\"}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:39:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json new file mode 100644 index 000000000000..04d7a5b2ac95 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f31748d1-e134-4658-9f48-be3468e2e46b", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "18", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "fbc0839b-e714-4d35-82d1-9ed082474088", + "x-aml-ta-request-id" : "4b7f60b8-14a1-4154-8448-71d5584bc6d3", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"type\":\"U.S. Social Security Number (SSN)\",\"subtype\":\"\",\"offset\":28,\"length\":11,\"score\":0.65}]},{\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"type\":\"ABA Routing Number\",\"subtype\":\"\",\"offset\":18,\"length\":9,\"score\":0.75}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:33:55 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json new file mode 100644 index 000000000000..d8de2ec4713f --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchInputShowStatistics.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii?showStats=true", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "52eddf3d-3eab-4f5f-ad18-432783d88f06", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "20", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "38c9a1ae-e3e3-49d9-98b2-77ddd260e7e2", + "x-aml-ta-request-id" : "2fe339d9-8240-4999-910c-e29b1e43ac44", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"entities\":[{\"text\":\"859-98-0987\",\"type\":\"U.S. Social Security Number (SSN)\",\"subtype\":\"\",\"offset\":28,\"length\":11,\"score\":0.65}]},{\"id\":\"1\",\"statistics\":{\"charactersCount\":105,\"transactionsCount\":1},\"entities\":[{\"text\":\"111000025\",\"type\":\"ABA Routing Number\",\"subtype\":\"\",\"offset\":18,\"length\":9,\"score\":0.75}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:39:26 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchStringInput.json new file mode 100644 index 000000000000..3ac82f6e88fe --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForBatchStringInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "e2ca3edd-e766-4340-ad98-e8f058b51beb", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "23", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "a372d434-7013-485b-a1c8-955804849156", + "x-aml-ta-request-id" : "5778e494-d7ae-459f-92ad-f61e320cc017", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"type\":\"U.S. Social Security Number (SSN)\",\"subtype\":\"\",\"offset\":28,\"length\":11,\"score\":0.65}]},{\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"type\":\"ABA Routing Number\",\"subtype\":\"\",\"offset\":18,\"length\":9,\"score\":0.75}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:31:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json new file mode 100644 index 000000000000..ce2093832905 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForEmptyText.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "08f15ac4-1e65-4f71-ab07-51ba0b33fce5", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "29e12e69-317e-4039-8725-b17056533036", + "x-aml-ta-request-id" : "dab6d532-4ac9-4666-b00e-33199f5a60e9", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"innerError\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"},\"message\":\"Invalid document in request.\"}}],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:33:56 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json new file mode 100644 index 000000000000..77b02c3d7530 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForFaultyText.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "5e42a69b-f818-42d2-8720-25e6c136e0cc", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "26", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "29e4f8de-9b8a-496f-bbf2-c3cbea8c0fff", + "x-aml-ta-request-id" : "12f4043a-d75f-4516-bcaf-19d7b163c30d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Fri, 27 Dec 2019 22:07:03 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json new file mode 100644 index 000000000000..4f22fa7aa060 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForListLanguageHint.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "f4838369-e84b-46d4-a921-71b507d889d5", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "17", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2", + "apim-request-id" : "b4505fcb-d6bb-4c47-9b1e-b26fc1f2fc07", + "x-aml-ta-request-id" : "7b8c578a-9a41-429a-805a-bcaf7f15dfe3", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"type\":\"U.S. Social Security Number (SSN)\",\"subtype\":\"\",\"offset\":28,\"length\":11,\"score\":0.65}]},{\"id\":\"1\",\"entities\":[{\"text\":\"111000025\",\"type\":\"ABA Routing Number\",\"subtype\":\"\",\"offset\":18,\"length\":9,\"score\":0.75}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:39:28 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForSimpleInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForSimpleInput.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForSimpleInput.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json new file mode 100644 index 000000000000..4acc96906d26 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/recognizePiiEntitiesForTextInput.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.0-preview.1/entities/recognition/pii", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.0.0-beta.1 (11.0.5; Windows 10 10.0)", + "x-ms-client-request-id" : "8e84a84c-5f7d-4fc8-85ab-3f0078607bc9", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-envoy-upstream-service-time" : "5029", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1", + "apim-request-id" : "840b486d-7f42-4515-a062-e2b73d14a1c3", + "x-aml-ta-request-id" : "001e66fa-702e-4184-8d13-0470c9aa7979", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"documents\":[{\"id\":\"0\",\"entities\":[{\"text\":\"859-98-0987\",\"type\":\"U.S. Social Security Number (SSN)\",\"subtype\":\"\",\"offset\":28,\"length\":11,\"score\":0.65}]}],\"errors\":[],\"modelVersion\":\"2019-10-01\"}", + "Date" : "Tue, 17 Dec 2019 22:35:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md b/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md new file mode 100644 index 000000000000..115f9e60af90 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md @@ -0,0 +1,33 @@ +# Azure Cognitive Service - Text Analytics for Java + +> see https://aka.ms/autorest + +### Setup +```ps +Fork and clone https://github.com/Azure/autorest.java +git checkout v3 +git submodule update --init --recursive +npm install +npm install -g autorest +``` + +### Generation +```ps +cd +autorest --java --use=C:/work/autorest.java +``` + +### Code generation settings +``` yaml +input-file: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.0-preview.1/TextAnalytics.json +java: true +output-folder: ..\ +namespace: com.azure.ai.textanalytics +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +models-subpackage: implementation.models +custom-types-subpackage: models +``` diff --git a/sdk/textanalytics/tests.yml b/sdk/textanalytics/tests.yml new file mode 100644 index 000000000000..ebea2a26976d --- /dev/null +++ b/sdk/textanalytics/tests.yml @@ -0,0 +1,13 @@ +trigger: none + +jobs: + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + ServiceDirectory: textanalytics + EnvVars: + AZURE_TEST_MODE: RECORD + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_TEXT_ANALYTICS_ENDPOINT: $(java-azure-textanalytics-sdk-endpoint) + AZURE_LOG_LEVEL: 3 From ab97a3e2614fffd163e8ae82c55e18c3f7c75b37 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Tue, 7 Jan 2020 11:33:02 -0800 Subject: [PATCH 2/2] Change JUL default log level as ALL --- .../main/java/com/azure/core/util/logging/ClientLogger.java | 3 +++ sdk/core/azure-core/src/main/resources/logging.properties | 4 +++- .../java/com/azure/core/util/logging/ClientLoggerTests.java | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java index a69f849876a3..5e084a6997bf 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java @@ -51,9 +51,12 @@ public ClientLogger(Class clazz) { * Retrieves a logger for the passed class name using the {@link LoggerFactory}. * * @param className Class name creating the logger. + * @throws RuntimeException it is an error. */ public ClientLogger(String className) { logger = LoggerFactory.getLogger(className); + System.setProperty("java.util.logging.config.file", + ClientLogger.class.getClassLoader().getResource("logging.properties").getPath()); defaultLogger = java.util.logging.Logger.getLogger(className); } diff --git a/sdk/core/azure-core/src/main/resources/logging.properties b/sdk/core/azure-core/src/main/resources/logging.properties index d3864f3a54f2..4eafd9e6583d 100644 --- a/sdk/core/azure-core/src/main/resources/logging.properties +++ b/sdk/core/azure-core/src/main/resources/logging.properties @@ -1 +1,3 @@ -.level = FINE +handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler +.level = ALL +java.util.logging.ConsoleHandler.level = FINER diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java index ef1c15b130dc..f335d82ba161 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/util/logging/ClientLoggerTests.java @@ -78,7 +78,7 @@ public void logAtSupportedLevelAtBinding(int logLevel) { logMessage(clientLogger, logLevel, logMessage); sh.flush(); - String logValues = logCaptureStream.toString(StandardCharsets.UTF_8); + String logValues = new String(logCaptureStream.toByteArray(), StandardCharsets.UTF_8); assertTrue(logValues.contains(logMessage)); }